Here is the simple script.sh file I have:
#!/bin/bash
pwd
date
ls -lg
I have used chmod +x to make the file executable, but when running it with ./script.sh I get command not found: pwd command not found: date and only the ls -lg command works. I'm a bit perplexed as to why the first two commands aren't working because when I type them into the command terminal they work the way they should.
yourprompt$ ./script.shuntil the script exits.) This is very helpful in file and character encoding issues, because even a missing or additional space, period or colon can hint at what's wrong and where.cat -A script.sh. This will show you any hidden characters. Ifcat -Adoesn't work, trycat -v.echo's in there, likeecho $PATH