Re: /bin/sh == bash?
On Sat, Aug 07, 2004 at 04:31:23PM +0200, Thiemo Seufer wrote:
> David Weinehall wrote:
> [snip]
> > > But why? Often the bashisms make scripts much more readable (and
> > > therefore maintainable). Especially for package build scripts.
> >
> > Well, I don't think I agree about often, but they do admittedly
> > sometimes. But most of the non-POSIX stuff I run into are:
> [snip]
> > function bla; bla() is at least as readable
> >
> > kill -<signum>; I'd say kill -s <sigspec> is far more readable
> >
> > trap "..." <signum>; I'd say trap "..." <sigspec> is far more readable
> >
> > pushd <dir> .... popd; (cd <dir> ....) is imho at least as readable
>
> The last change would affect the script's semantics. 'cd' calls aren't
> easily nestable.
It's quite easy to nest calls to `cd'.
tao@smyslov:~$ (cd /usr/share/man; ls; (cd /etc; ls -d rc*); ls)
cs/ es_ES/ hu/ ja/ man2/ man5/ man8/ pt_BR/ sv/
de/ fr/ id/ ko/ man3/ man6/ man9/ ru/ tr/
es/ fr_FR/ it/ man1/ man4/ man7/ pl/ ru_RU/
rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/ rcS.d/
cs/ es_ES/ hu/ ja/ man2/ man5/ man8/ pt_BR/ sv/
de/ fr/ id/ ko/ man3/ man6/ man9/ ru/ tr/
es/ fr_FR/ it/ man1/ man4/ man7/ pl/ ru_RU/
Nests just fine, imho... Of course, in a shell script, it could be
expressed a little nicer, with indentation.
Regards: David Weinehall
--
/) David Weinehall <tao@acc.umu.se> /) Northern lights wander (\
// Maintainer of the v2.0 kernel // Dance across the winter sky //
\) http://www.acc.umu.se/~tao/ (/ Full colour fire (/
Reply to: