Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Dec 2007 19:33:22 +0100
From:      Peter Schuller <peter.schuller@infidyne.com>
To:        freebsd-questions@freebsd.org, Frank Shute <frank@esperance-linux.co.uk>
Cc:        Mike Jeays <mike.jeays@rogers.com>
Subject:   Re: Apparently, csh programming is considered harmful.
Message-ID:  <200712171933.32626.peter.schuller@infidyne.com>
In-Reply-To: <20071214211008.GA12935@melon.esperance-linux.co.uk>
References:  <20071214010542.GA19553@demeter.hydra> <200712132012.32729.mike.jeays@rogers.com> <20071214211008.GA12935@melon.esperance-linux.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
--nextPart1415729.3e3akt1Iy2
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

> other BSDs for that matter. It being GPL guarantees that quite apart
> from it general suckiness.

Can someone please explain why bash sucks?

Everyone keep's saying this but I have never heard anyone explain why, othe=
r=20
than the GPL issue. I really want to know.

(This is not because I'm a bash fan. My personal favorite happens to be zsh=
=2E)

> I tried replacing /bin/bash with /bin/ksh on a Linux system and it
> almost completely broke it. Suggests the Linux folks can't write
> boot scripts without bashisms.

If this is a poke at the use of #!/bin/sh when the script actually requires=
=20
bash, I 100% agree.

However, if your intent (and the intent of Chuck Robey in that earlier) pos=
t=20
is to imply that it's bad programming practice to write anything than POSIX=
=20
compatible scripts, then I have to ask again - why?

This is kind of a pet peeve of mine, so here goes somewhat of a rant. Pleas=
e=20
enlighten me as to why I am wrong:

I don't understand why everyone insists on POSIX compliance for portability=
=20
with shell scripting. The POSIX common demoniator seems to suck. Seriously.=
=20

One keeps seeing things like:

   if [ x"$var" =3D x"value" ]

When the intent is:

   if [ "$var" =3D "value" ]

Because there is presumably some wonky script out there that breaks on the=
=20
former (or perhaps its POSIX, dunno). I have recently began to appreciate=20
that all this madness that would normally be considered unforgivable code=20
obfuscation in anything but shell scripting, is all an attempt to somehow b=
e=20
portable.

In any number of situations I would consider it much preferable to juse cho=
ose=20
one particular shell and stick to it, rather than having to do battle with=
=20
all these minor incompatibilities. Many major shells are very portable to=20
begin with, and in many situation you *REALLY* don't care about some exotic=
=20
Unix platform that 10 people in the world run, but where bash/zsh/whatever=
=20
doesn't.

Another example of the madness is:

   http://www.netbsd.org/docs/pkgsrc/makefile.html

Check out section 12.3.3. Can anyone claim that it is sensible for it to be=
=20
this fricking difficult *to print the value of a variable*?

Although that last bit has to do with more than the choice of a shell, it=20
highlights perfectly the type of trouble you run into when you try to be=20
portable with the least common denominator.

=2D-=20
/ Peter Schuller

PGP userID: 0xE9758B7D or 'Peter Schuller <peter.schuller@infidyne.com>'
Key retrieval: Send an E-Mail to getpgpkey@scode.org
E-Mail: peter.schuller@infidyne.com Web: http://www.scode.org


--nextPart1415729.3e3akt1Iy2
Content-Type: application/pgp-signature; name=signature.asc 
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4 (FreeBSD)

iD8DBQBHZsD8DNor2+l1i30RAk49AJ0RrBQ8cKhtB7MB5m6gwDpTcJh86gCfTKd+
pw3lIItKpUiw0HVHyNpjoDU=
=CNxT
-----END PGP SIGNATURE-----

--nextPart1415729.3e3akt1Iy2--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200712171933.32626.peter.schuller>