shell scripts in system commands
Bill Vermillion
fp at wjv.com
Wed Nov 24 21:33:37 PST 2004
On Wed, Nov 24 23:53 , Brian K. White gie sprachen "Vyizdur zomen
emororz izaziz zander izorziz", and continued with:
> Can anyone with a sco box and a recent version of fp
> corroborate something for me?
I'll not do that, but just want to make a comment below.
> The most technically correct way to write a shell script is
> to specify the shell in the first lint that should be used to
> interpret the rest of the script. This makes the script more
> robust by not relying on hoping that the users shell, at the
> time the script is run, just happens to be the right one.
> ie:
> -----start-----
> #!/bin/ksh
>
> echo "This would not work in sh or bash!"
At one time the most technically correct way to start
shell scripts was like this:
:
#!/bin/ksh
It has been SO LONG since I read why but some of the older
other shells beside the Bourne Shell [aka /bin/sh] needed
the colon on the first line and then then
octothorpe(#)exclamation(!)/pathto/shell on the second line.
If anything is still expecting that old syntax that could
be a problem. Probably not at all relevant but just thought
I'd add the variant to 'technically correct'.
That notation still lives in 'magic' as this short hunk
will show.
========================================
# commands: file(1) magic for various shells and interpreters
#
0 string : shell archive or script for antique kernel text
0 string/b #!\ /bin/sh Bourne shell script text executable
0 string/b #!\ /bin/csh C shell script text executable
# korn shell magic, sent by George Wu, gwu at clyde.att.com
0 string/b #!\ /bin/ksh Korn shell script text executable
0 string/b #!\ /bin/tcsh Tenex C shell script text executable
0 string/b #!\ /usr/local/tcsh Tenex C shell script text executable
0 string/b #!\ /usr/local/bin/tcsh Tenex C shell script text executable
========================================
Bill
--
Bill Vermillion - bv @ wjv . com
More information about the Filepro-list
mailing list