when I use simple bash command
#!/bin/bash echo Please, enter your name read NAME echo "Hi $NAME!"
and run it using
source filename.sh it gives me an error
what could be the problem? I search but there is no solution.
Summary for future reference:
The shebang points to
/bin/bash but the
source command makes the code run in a current shell which turned out to be
The code works on my
bash on Debian and it doesn't work on my
csh there, when invoked with
source filename.sh. Yet it looks like the OP's intention was to run it with
To make it run with
bash as intended, it needs to be made executable (
chmod a+x filename.sh) and invoked by
And finally the
#!/bin/bash shebang had a wrong path in this particular case.