[ale] changing dash to bash in ubuntu

arxaaron arxaaron at gmail.com
Tue Feb 22 04:05:07 EST 2011


On 2011/02/21, at 09:06 , Lightner, Jeff wrote:

> A couple of notes on the thread:
>
> Issues with /bin/sh being linked to things other than bash aren't  
> new -
> I've seen them discussed on other forums for more than a yar.
>
> One poster talked about "sh" in a way that led me to believe he was
> discussing the original Bourne Shell.   The POSIX shell (which is sh  
> in
> say HP-UX) is more like Korn Shell (ksh).
>
> Another poster talked about pdksh - that was an abomination that  
> didn't
> really do things quite the way ksh did.   Linux now has ksh available
> for those of old farts that knew and liked ksh.   (For RHEL users you
> could get ksh instead of pdksh as of RHEL5 from the repositories.)
>
> I agree with others though - If you design something in a specific  
> shell
> make your interpreter line specific to that shell:  #!/bin/bash,
> #!/bin/ksh, or even #!/bin/sh if it is on a system that has that as a
> native POSIX shell.   If you're writing it for portability you might
> want to put tests in that help to verify what shell it is actually  
> using
> and note there are differences sometimes from version to version.
> Things I wrote using #!/bin/ksh when it was pdksh had some minor  
> issues
> when it was real ksh.

Good points on version checks.  Some involved scripts that
I've written for bash on Linux needed tweaking to run with the
BSD bash on Mac OSeX.  Biggest issue was some built in bash
string functions that I used in Linux were missing in BSD.
The standard suite of included external shell programs can
be different or be missing flags as well.  I recall some slightly
different quote handling being the quirkiest debugging
challenge, though.

peace
aaron



> -----Original Message-----
> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
> Brian Pitts
> Sent: Sunday, February 20, 2011 3:11 PM
> To: Atlanta Linux Enthusiasts
> Subject: Re: [ale] changing dash to bash in ubuntu
>
> On 02/18/2011 09:46 PM, James Sumners wrote:
>> The problem
>> is that they claim dash to be a POSIX shell, but when people report
>> bugs[1] in dash they get written off as "not a POSIX bug" when in  
>> fact
>> they are..
>
> That's pretty much the opposite of what I take away from that link.
> Colin Watson's comment seems pretty clear-
>
>> As far as non-POSIX constructs go, Paul Smith is right on the money
> with his comments in
> https://bugs.launchpad.net/ubuntu/+source/dash/+bug/141481/comments/ 
> 4, I
> think. The proper analogy is a C compiler: it is not a bug in the C
> compiler if it stops accepting code that doesn't conform to the  
> standard
> and doesn't declare that it uses an extension (in this case, by saying
> #! /bin/bash). This is of course not to say that the real dash bugs  
> that
> have been identified here should not be fixed.
>
> If you look at the individual bugs linked to from bug #141481, the  
> cases
> where dash was failing to conform to POSIX have been fixed in dash;  
> i.e.
>
> https://bugs.launchpad.net/ubuntu/+source/dash/+bug/92189
> https://bugs.launchpad.net/ubuntu/+source/dash/+bug/105634
>
> -- 
> All the best,
> Brian Pitts



More information about the Ale mailing list