[Dune-devel] bash in shell scripts

Andreas Lauser andreas.lauser at iws.uni-stuttgart.de
Thu May 2 15:32:18 CEST 2013


Hi,

On Thursday 02 May 2013 09:01:50 Markus Blatt wrote:
> thanks a lot for the enlightenment.
> 
> On Wed, May 01, 2013 at 08:46:57PM +0200, Elias Pipping wrote:
> > On Wed, May 1, 2013 at 12:20 PM, Elias Pipping 
<pipping.elias at gmail.com>wrote:
> > > Here's a quick run-down of some features of interest:
> > >   posix shell: $(cmd) to capture output of a command
> > >   2.02 (e): [[ command (a replacement for `test` or `[`)
> > >   2.05b (n): <<< "here-string" operator
> > >   2.05b (g): [:word:] character classes
> > >   4.0 (hh): ${var,}, ${var,,}, ${var^}, ${var^^}, etc.
> 
> Let us take a look at the versions of some (more stable) distributions:
> 
> Debian squeeze (to be old-stable from May 5): 4.1.5(1)
> Redhat 5: 3.2.1
> 
> While I am all for backwards compatibility (which does not hold here
> anyway), discussing bash version 2 seems quite esoteric to me. The
> others are supported anyway and nobody had problems yet.

IMHO the problem with bash-specific features is not only backwards 
compatibility: For performance reasons, some linux distributions use a 
different default shell (e.g. Debian and derivatives use dash), so that at 
least shell scripts which use /bin/sh should avoid bash-specific features. 
Besides, using these features might cause unnecessary issues on more exotic 
systems like the BSDs, i.e., relying on them -- as well as on GNU-specific tool 
options -- is bad style for code that is intended to be portable, IMHO. Elias 
thus has a point, I just don't know what can be done about it...

cheers
  Andreas

-- 
Andreas Lauser
Department of Hydromechanics and Modelling of Hydrosystems
University of Stuttgart
Pfaffenwaldring 61
D-70569 Stuttgart
Phone: (+49) 711 685-64719
Fax: (+49) 711 685-60430
www.hydrosys.uni-stuttgart.de




More information about the Dune-devel mailing list