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

Re: shell scripting book



On Fri, Jul 27, 2001, Adi Stav wrote about "Re: shell scripting book":
> > In that case I recommend Zsh, and you can find documentation on it in
> 
> To that I'd like to flamingly add that if you're already going to learn
> shell scripting, learn portable shell. Plain bourne shell is quite 
> a powerful environment in itself, and I personally find that the cooler
> a non-standard non-interactive shell feature seems to me, the less 
> portable it is. Not that there's anything wrong with interactive 
> features.

Good point.

A Bonsai guide I once read had a smart maxim: "[for some] the thrill is in
breaking all the rules... [but] it is probably a good idea to learn the rules
before you go breaking them (that way at least you will know you are breaking
them)".

So while programming using the extensions in zsh or bash can be much more
"thrilling" than programming with the boring old standard Bourne Shell,
it is important to know the "rules" of the latter, because it is a Posix
standard and is usually the only shell available in commercial Unixes.

[but remember, you can always program on whichever free shell you prefer, and
compile that shell on machines that don't have it installed!]

Note that in this respect bash is just as non-standard as zsh - neither can
be found on stock installations of most commercial "Unix", both can be
installed from source (for free) on any Unix-like machine (or even Windows!),
and both can be found in good Linux installations. It's interesting to note
that I don't know of any implementation of a strict bourne shell on Linux -
I think that even ash has more features than the old Bourne Shell.

It it is not true, by the way, that the extensions in zsh and bash are all
related to interactive use. Both of them (and also pdksh, another free shell)
have many extentions over the bourne shell, most of them stem from the 1988
version of ksh by Bell Lab's David Korn (his 1993 ksh version was recently
freed - search for David Korn's homepage). These extensions make programming
shell scripts much easier, and much more efficient (e.g., to do simple string
manipulation and integer math it is no longer necessary to use the external
'expr' command: instead builtin ${..##..} and 'let' are available), arrays
are available, and so on. Even functions did not exist in the original
Bourne Shell! (but I believe they do exist in the Posix standard).

-- 
Nadav Har'El                        |         Thursday, Jul 26 2001, 7 Av 5761
nyh@math.technion.ac.il             |-----------------------------------------
Phone: +972-53-245868, ICQ 13349191 |Cement mixer collided with a prison van.
http://nadav.harel.org.il           |Look out for sixteen hardened criminals.

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il