On 4/24/2015 10:47 AM, Gordon Messmer wrote:
On 04/24/2015 03:57 AM, Pete Geenhuizen wrote:
if you leave it out the script will run in whatever environment it
currently is in.
I'm reasonably certain that a script with no shebang will run with
/bin/sh. I interpret your statement to mean that if a user is using ksh
and enters the path to such a script, it would also run in ksh. That
would only be true if you "sourced" the script from your shell.
A script with no shebang will run in the environment of the account
running the script. If that account is root and root uses the bash
shell then the script will run in the bash shell. If that account uses
the korn shell then the script will run in a korn shell... etc. So it
depends and Pete was more correct.
All the Sun systems I worked on (way in the past) had the bourne shell
on the root account and I usually set my account up with a korn shell.
On linux boxes both the root and personal account use the bash shell.
Some systems will use a C shell, and, of course, other choices.
If you want a script to run under a specific shell you NEED the shebang
line at the beginning. Assuming the bourne shell as a default is not
reliable.
If you use good coding practices you will have that shebang line at the
beginning of all scripts.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos