LWN.net Logo

Advertisement

Front, Kernel, Security, Distributions, Development. See your byline here on LWN.net.

Advertise here

Bash 4.0 released

Bash 4.0 released

Posted Feb 23, 2009 21:40 UTC (Mon) by madscientist (subscriber, #16861)
Parent article: Bash 4.0 released

I don't begrudge anyone increasing functionality for their shell, and I've been using bash for longer than Linux has even been around and I love it to death, but I shudder to imagine all the new scripts that will be written and distributed that require bash in ever more complex ways... and will invariably say "#!/bin/sh" at the top and fail to work on many Linux systems and any other UNIX system... for no particularly good reason except "all the shell's a bash, right?"


(Log in to post comments)

Hopefully not for very long

Posted Feb 23, 2009 22:39 UTC (Mon) by khim (guest, #9252) [Link]

/bin/sh is not longer bash in Ubuntu (and Debian in some uncertain future) so such scripts will not work there - and Ubuntu is quite popular. I hope other distributions will follow and stop using bash as /bin/sh - it'll close this "problem" once and for all...

Hopefully not for very long

Posted Feb 25, 2009 10:28 UTC (Wed) by nlucas (subscriber, #33793) [Link]

True, but that doesn't solve the problem of many scripts assuming bash is "/bin/sh".

I end to "dpkg-divert" to "/usr/bin/bash" because it's easier than fixing all the scripts that cease to work. Even if that makes booting even longer (one of the arguments, iirc, was that dash cuts booting times by several seconds).

Hopefully not for very long

Posted Feb 25, 2009 19:42 UTC (Wed) by man_ls (subscriber, #15091) [Link]

I always start my custom scripts by "#!/bin/bash". Not that I use any machine where it will actually matter (except at work on braindead AIX installations), but if it will change on Debian as you say it is nice to know that it will fail instead of work in weird ways.

Someone should start a campaign for "#!/bin/bash".

Bash 4.0 released

Posted Feb 23, 2009 23:23 UTC (Mon) by salimma (subscriber, #34460) [Link]

#!/bin/sh really ought to be Bash in reduced functionality mode -- i.e. it should emulate the behavior of the original sh.

It'd be really nice if #!/bin/bash-4 runs Bash in version 4 mode, wheras #!/bin/bash-3 would turn off the version 4 features. A poor man's versioned interface. If bash itself does not do it, then distributors can emulate it by shipping two versions of Bash as bash-3 and bash-4 respectively.

Bash 4.0 released

Posted Feb 24, 2009 20:09 UTC (Tue) by felixfix (subscriber, #242) [Link]

Bash behaves differently when run as sh instead of bash, I think restricting itself to POSIX compatibility, but it's been a long time since this mattered to me in my job. so I could be wrong and/or out of date.

Bash 4.0 released

Posted Mar 6, 2009 16:57 UTC (Fri) by Duncan (guest, #6647) [Link]

Yes, bash behaves differently when run as sh, but sh purists, particularly
those in the BSD and Linux embedded camps that don't necessarily have bash
installed let alone as sh, tend to have a rather long list of how buggy
bash is at actually enforcing POSIX sh mode, based on the number of
scripts they've had to deal with that were designed and tested only with
bash in sh mode, not on a real POSIX sh that actually enforces the
standard.

Thus the original comment...

(Said as one that always uses the #!/bin/bash myself, as I make no
apologies for only learning bash and not even knowing what's sh behavior
and what's not, tho thinking of turning it into the env form. Where
people are trying to use my scripts on non-bash systems, I do take
patches.)

Duncan

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds