[sf-lug] crash course in scripting, etc
Michael.Paoli at cal.berkeley.edu
Mon Apr 2 22:48:25 PDT 2007
Ah, gee, I'd be inclined to suggest BUUG, but that would be
a bit too late ... presuming you're talking this Wednesday
(BUUG is 1st & 3rd Thursdays).
In the meantime, this may come in fairly handy too:
It's a wee bit dated (starts from ye olde Borne shell), but
*most* of the important stuff is still the same - particularly when
it comes to scripting/programming. There's also a lot less to bite off
at once (ye olde Bourne shell from UNIX 7th edition - the man page is
*only* 6 pages! ... but it is packed pretty densely with information ...
contrast that to roughly 50 pages for the man "page" for bash or
ksh ... and multiply that by about 4 or so to get up to a book that
covers such fairly well in terms of a programming/scripting training
manual and reference). Anyway, at the URL I note above, there's also a
fair bit of examples and syntax examples. If you can go through all
that and well understand it all, you'll be pretty well on your way.
Comparing current standards and de facto standards (BASH, POSIX/SUS) to
ye olde Bourne shell (from UNIX 7th edition) most of what one needs to
know for programming/scripting is about the same. There's lots of
"bells and whistles" added to Bash (and Korn) that make it much
handier for interactive use ... but most of that is of little consequence
to the actual coding of shell scripts/programs themselves. Some of the
syntax for trap is a bit different now (the former being deprecated or (just
barely) obsoleted (by a slight difference)), there are now two forms for
doing command substitution (the newer form being much more sane if one
needs to nest command substitutions), there's use of -- even with built-ins
such as set ... those are the few differences that jump to mind. Current
day Bourne/Korn/Bash and the applicable standards (POSIX/SUS/LSB/...) are
quite highly backwards compatible (but not quite fully 100% backwards
compatible) with ye olde Borne shell.
Also, another random useful reference - go over the relevant FAQ(s), and
understand both the questions, and their answers, e.g.:
and for UNIX (or LINUX) context, probably also:
There are probably a fair number of other similarly useful resources out
there (e.g. searching on news:comp.unix.shell may turn up many useful
Of course there are also good shell programming books and guides and such
out there too. Use whatever works for you that you can best utilize with
the time you have to work with.
And if you're looking for yet more examples, on the sf-lug.com. host
under ~mpaoli - if you can get to it (e.g. read and/or execute it) with
mere mortal user (e.g. without becoming superuser ("root") access, consider
it fair game to inspect, learn from, etc.
Quoting "Peters, Ola (MSCIBARRA)" <Ola.Peters at mscibarra.com>:
> Must have missed the note where you were going to be gone...
> Geeze..scare a person. Hey, need a crash course in scripting, etc,
> before Wed...is it possible??? Please...that job I want, I got the
> interview Wednesday. I think I told you I had the second one, right?
More information about the sf-lug