Re: writing shell scripts
- From: Bob Melson <amia9018@xxxxxxxxxxx>
- Date: Wed, 18 Mar 2009 23:48:47 -0600
On Wednesday 18 March 2009 23:12, Lars Eighner (usenet@xxxxxxxxxxxxxxx)
In our last episode, <gpsitl$2t6g$1@xxxxxxxxxxxxxxxxxxxx>, the lovely and
talented Christopher Chambers broadcast on comp.unix.bsd.freebsd.misc:
Does anyone know a good referrence source that teachs you how to write
I tried typing "man foreach" but it was no help.
Shirley man <name of shell> would be more likely to be informative.
Lars Eighner SAVE BEASTIE! "What do you do when you're
"Stale dependency": When pkgdb -F reports this, it means the dependency
missing, not that the dependency is obsolete.
Apart from the above advice, I'd ask what you have in mind for your
scripting. While it's possible to write multi-page scripts in the shell
of your choice - see portmaster in the ports collection for an excellent
example - the general rule of thumb is that shell scripts should be a page
of less in length. Anything more should be written in, e.g., perl or
python or an equivalent scripting language. This isn't hard and fast (and
isn't meant to set off a religious war!), but is something to keep in mind
as you approach the task you want to script.
As for specific books, look for "The KornShell Command and Programming
Languge", by Morris Bolsky and David Korn, Prentice-Hall, and "The UNIX C
Shell Field Guide", by Gail and Paul Anderson, also from P-H. I don't
know if either is still in print - my copies are 15-20 years old - but
both are much thumbed, excellent references to the specific shell
languages. You might be able to find them in a used book store or
on-line - worth a shot.
Bear in mind, too, that both ksh and bash are super-sets of the original
Bourne shell (sh), while csh/tcsh/zsh form a family of their own. Each
family has its own merits and demerits which you'll have to learn for
yourself. Another general rule of thumb - if you learn ksh or bash, you
will have learned the other variants; the same applies with csh/tcsh/zsh -
learn one and you've pretty well learned all of them. Yes, there ARE
differences and "improvements" in the later shells, but there is also a
high degree of consistency within the families.
Didn't mean to write a book or to set off WW-3 here. Hope this helps.
Scriptin' Ol' Bob
Robert G. Melson | Rio Grande MicroSolutions | El Paso, Texas
A government big enough to give you everything you want is big
enough to take away everything you have. Thomas Jefferson
- Prev by Date: Re: writing shell scripts
- Next by Date: Re: writing shell scripts
- Previous by thread: Re: writing shell scripts
- Next by thread: Re: writing shell scripts