[NTLUG:Discuss] what is ":bad option"?

Steve Baker sjbaker1 at airmail.net
Sat Jul 29 18:44:58 CDT 2000


m m wrote:
> 
> Someone told me here (sorry I deleted the mail)
> If I am using bash, the it should be:
> #! /bin/bash
> yes, I use RH 6.2 default, which is bash (I guess, maybe wrong), but I check
> some script files, they are begin with
> #!/bin/sh
> I don't know what to say.

You should really use '/bin/sh' because Bash is just a re-implementation
of 'sh' (the original 'Bourne Shell') - albeit with a lot of fancy add-ons.
'/bin/sh' works because that file is just a link to /bin/bash (or whatever
other Bourne Shell clone you might happen to be using).

So, if you use /bin/bash, it'll work - but not on a machine that has a different
Bourne shell clone installed on it (for example - my SGI machine at work that
only has the *true* Bourne Shell and a bunch of C-Shell clones).

If you do in fact use any of Bash's extensions to Bourne shell - then I suppose
you should say /bin/bash and realise that your script isn't going to be as
portable as you might perhaps hope.

Similarly, if you use tcsh (as I do) then you should say '/bin/csh' rather
than '/bin/tcsh' because tcsh is just a clone of csh (C-shell) - with a bunch
of enhancements.

Portability of scripts isn't often a big issue though - so I wouldn't sweat it
too much.

-- 
Steve Baker   HomeEmail: <sjbaker1 at airmail.net>
              WorkEmail: <sjbaker at link.com>
              HomePage : http://web2.airmail.net/sjbaker1
              Projects : http://plib.sourceforge.net
                         http://tuxaqfh.sourceforge.net
                         http://tuxkart.sourceforge.net
                         http://prettypoly.sourceforge.net






More information about the Discuss mailing list