How to go back to bash (from dash)?

Magnus Therning magnus at therning.org
Fri Oct 14 09:08:46 UTC 2005


On Fri, Oct 14, 2005 at 01:01:57PM +0700, Ali Milis wrote:
>Magnus Therning wrote:
>
>> >May I know, how to return to bash as  /bin/sh (from dash)?
>> >Why it is not in /etc/alternatives?
>>
>> $ sudo dpkg-reconfigure dash
>>
>> Then you'll be asked if you want dash to be /bin/sh. Answer "no" and you
>> revert to having bash as /bin/sh.
>
>Thank you! May I know what was behind introducing POSIX's "dash"?
>Many bash scripts break if using dash  B-(
>
>And is there any specific reason not using /etc/alternatives?

All good questions. :-) Don't take my answers as authoritative, I'm just
making this up as I go ;-)

I imagine one could argue that shell scripts that start with

 #!/bin/sh

should be POSIX shell compatible. I.e. they should work under any POSIX
compliant shell (bash, dash, ksh, zsh, ...). If you need some non-POSIX
extension then you should explicitly use the desired shell, e.g.

 #!/bin/bash

It's a little unfortunate that invoking bash as `sh` only turns on
POSIX-compliant startup behaviour, it doesn't disable bash's non-POSIX
extensions. (This is based on what I've read in the man-page, and it
seems to be supported by your statements as well.) So, in short, using
bash-isms in a shell script that starts with

 #!/bin/sh

results in bugs.

/M

-- 
Magnus Therning                    (OpenPGP: 0xAB4DFBA4)
magnus at therning.org
http://therning.org/magnus

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

For a successful technology, reality must take precedence over public
relations, for nature cannot be fooled.
     -- R.P. Feynman
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20051014/a74fd0d7/attachment.sig>


More information about the ubuntu-users mailing list