> in comp.unix.shell i read:
>>>Maybe because (at least on my Linux box) /bin/sh is a symlink to
>>>/bin/bash.
>>It's always bugged me that bash doesn't allow bash-isms when called
>>as sh . It makes it hard to create scripts on e.g. Linux machines
>>and then port them to machines where sh really is sh .
> actually that's backwards. (ah, i see that you caught that later.)
Yes, I've got this *terrible* tendency to say the opposite of what I
mean. For example, I'll be giving someone directions, and say, "now
turn left on 5th Street and head south" and people will reply "wouldn't
a left turn point me north?" and the smack! sound of my palm striking
my forehead can be heard for miles around.
Obviously, it's starting to creep into my Usenet posts as well. Now I'm
really starting to get worried. :)
Quote:> if you
> want portability you have to work at it. using zsh can help since it
> provides a different subset and restrictions when invoked as sh. ksh can
> also help to remove the bash-ism's. though you have to be careful not to
> replace them with ksh-ism's or zsh-ism's -- which *can* be tempting. maybe
> develop your scripts on your lowest common platform, instead of the
> platform you like to use -- hee.
All correct, and the lowest-common-platform technique (or rather, the
use-the-platform-where-sh-is-really-sh technique) is what I use when I
have to create a Bourne shell script that has to run on multiple platforms.
However, I also have to contend with what other people write, and now even
autoconfigure scripts are starting to get bash-ism's in them, since often
the package being autoconfigured started out on Linux. If bash would simply
really emulate sh when called as sh, this would tend to be less of a problem.
It's not a big deal, and I realize the author(s) of bash may well have had
better things to do when starting bash, but it would have been nice. Of
course, it's probably far too late to go changing it now.
When I get a "sh" script, e.g. in the form of an autoconfigure script or
install script from some software vendor who wrote it on a platform where
sh->bash, and have to run it on a system where sh is really sh, it's usually
easier to just change the first line of the script to #!/path/to/bash (which
may require installing bash). Funny, bash is sort of Microsoftian in that way;
its shortcomings further its necessity. :)
--
Griff Miller II | |
Manager of Information Technology | If you're too open-minded, |
Positron Corporation | your brains might fall out. |