[OT] Is it "#!/bin/bash", "#! /bin/bash", or does it even matter?
jtwdyp at ttlc.net
Sun Oct 25 02:09:34 UTC 2009
Memory can be a silly thing.
I know that if I want a script to be run by a particular shell (such as bash)
then I want the first line of the script to start with "#!" followed by the
path to the shell involved. But it suddenly occurred to me that I may have
been doing it wrong.
I'm not sure if it's supposed to look like:
And for that matter how about:
Which I'm likely to get because to be honest I can never remember if it's
/bin/bash or /usr/bin/bash etc... So since I tend to use vim to edit my
scripts, what I actually tend to do is "ggO#!^[:r!which bash^MkJ" But now I
wonder if I need to add "x" or "2x" to the above...
I figure that if one of the above wasn't interpreted as a request to run the
script in bash then it would be treated as a comment line. And the only way
I'd know that was happening would be if I actually included something that
worked in bash, but not in whichever shell happened to run the script.
And I'm not good enough with any of the other shells to be sure I'd spot
the problem. So I'm not really sure if my scripts are correctly specifying
that they should be run in the bash shell. Would some better script
programmer than I am, kindly set me straight.
| ~^~ ~^~
| <?> <?> Joe (theWordy) Philbrook
| ^ J(tWdy)P
| \___/ <<jtwdyp at ttlc.net>>
More information about the kubuntu-users