Tuesday, 20 August 2013

Does the shebang determine the shell which runs the script?

Does the shebang determine the shell which runs the script?

This may be a silly question, but I ask it still. If I have declared a
shebang
#!/bin/bash
in the beginning of my_shell_script.sh, so do I always have to invoke this
script using bash
[my@comp]$bash my_shell_script.sh
or can I use e.g.
[my@comp]$sh my_shell_script.sh
and my script determines the running shell using the shebang? Is it the
same happening with ksh shell? I'm using AIX.

No comments:

Post a Comment