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

Re: /bin/sh == bash?



On Sat, Aug 07, 2004 at 10:26:48AM +1000, Hamish Moffatt wrote:
> On Fri, Aug 06, 2004 at 10:29:55PM +0200, David Weinehall wrote:
> > Please, usually the non-POSIX stuff is easy to remove, and just papering
> > over the problems by using SHELL=/bin/bash should only be used as
> > a solution when no other option seems reasonably possible.
> 
> 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:

`-a' and `-o' in tests; `&&' and `||' are at least as readable,
especially since `-a' is overloaded (a ksh:ism supported by bash; use
`-e' instead)

source <filename>; . <filename> is arguably a bit less expressive, but
not to the point of unreadability

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

> And bash is essential, so why not use it?
>
> I can see that a minimal Debian system (eg an embedded system) might
> want to omit bash to save space, but a development system could always
> include it.

Well, I both work with, and play with in my spare time, quite a lot
of embedded systems.  And while indeed package build scripts using bash
is no problem at all, it's a well known fact that people code by
example, so use of bashisms, XSI:isms, etc in build scripts tend to
spread to the runtime scripts, and that's when things stop playing
nicely with embedded systems.

> Next thing you'll ask me to stop using VIM too :)

Considering I use VIM for almost everything, including writing texts
that later end up in *cough* Word-documents, that would be a bit stupid
of me...  =)  The only other editor I use is the one built into
Evolution1.5, and that's only because I haven't found a GNOME component
of VIM yet.  If anyone knows of one, I'd be glad to know.


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: