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

Re: POSIX scripting tip

Herbert Xu <herbert@gondor.apana.org.au> writes:

> Philip Brown <phil@bolthole.com> wrote:
> > I specified that the above was a feature of **POSIX** sh.
> > Bash is not a POSIX-compliant shell.

foo{1,2} is NOT part of POSIX sh. 

You should NOT use it in sh scripts that you intend to be portable including
debian postinst et al scripts. This is not a feature worth using #!/bin/bash
for your postinst script in my opinion.

It would be nice to turn off as many of bash's non-posixisms from dpkg by
setting an environment variable before running bash. At least during unstable
like we used to disable --force etc. Then reenable these things before we
release and final testing. But this would at least reduce the likelihood of
these errors being introduced in the first place.

> > [hence it is a Bad Thing that /bin/sh is a link to /bin/bash]
> > (Mind you, I am guessing a bit that it in the actual POSIX spec.
> >  I know it's in the KSH spec, which mostly defines POSIX-sh, and

The POSIX spec can be perused at 

There's no such thing as a ksh spec just as there's no such thing as a bash
spec. So there's no such thing as a portable ksh script just as there's no
such thing as a portable bash script. Code that isn't targeted at a specific
standard cannot be sure it won't fail on a different version of bash or ksh or
on a different platform.


Reply to: