I'm Trying to create a simple shell script to loop through a file line by line and execute a command with each line as a variable.
Here is my Text File:
FakeAccount
FakeUser
Here Is My Shell Script:
#!/bin/bash
while IFS= read -r line; do
"echo -e 'testpassword\ntestpassword' | passwd $line"
done < "User.txt"
The Output i get back seems to be what i want, the output says:
"line 4: echo -e 'testpasswd\ntestpasswd' | passwd FakeAccount: command not found"
"line 4: echo -e 'testpasswd\ntestpasswd' | passwd FakeUser: command not found"
But if i copy this exact string: echo -e 'testpasswd\ntestpasswd' | passwd FakeUser
the command works just fine so why is the shell script not executing the command and its saying command not found?