bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: last argument expansion has different output using the sh interprete


From: Bob Proulx
Subject: Re: last argument expansion has different output using the sh interpreter
Date: Fri, 27 May 2011 14:57:03 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Jacoby Hickerson wrote:
> Although, I am curious, is this is a matter of sh being continually
> updated to exclude all bash extensions or perhaps previously bash
> didn't interpret #!/bin/sh to be the POSIX compliant interpreter?

When bash is invoked as sh then bash complies with the POSIX sh.  That
is both required and desired.

On some GNU/Linux systems /bin/sh is a symlink to /bin/bash and bash
will support running as a POSIX sh.  But this isn't universal.  On
other systems /bin/sh is an actual native POSIX sh, on others it is a
symlink to /bin/ksh or /bin/zsh or /bin/dash or others.  But in all
cases /bin/sh is supposed to be a POSIX sh and conform to the
standard.  Bash tries to be compliant but some differences will creep
in regardless.  Doing so may cause problems for people who unknowingly
use features on one system that are not available on other systems.
Generally the wisdom of years is not to be generous in what you accept
but to be strict in what you accept.  It makes portability easier.

Having found that the bash specific feature isn't available in /bin/sh
this is a good thing for you since now your script will either need to
specify that it needs bash explicitly or you could use portable only
constructs and continue to use /bin/sh.  Personally I use bash for my
command line but /bin/sh and portable constructs for shell scripts.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]