JP Vossen on 29 Oct 2007 21:51:56 -0000


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

Re: scripting books (was Re: [PLUG] non-nerdy ... a non-rant)


> Date: Fri, 26 Oct 2007 22:44:08 -0400
> From: "Brent Saner" <brent.saner@gmail.com>
> Subject: Re: [PLUG] non-nerdy ... a non-rant

[Brent]: oooh, you're about to pop your scripting cherry!
[Jeff]: much like the other one, I prefer having someone else involved.

I can help... Oh wait, that really didn't come out right... What I *mean* is, I wrote a book about that. No, no; *scripting;* I wrote a book about *scripting*... (Advice when you've dug yourself into a hole--stop digging! :-)


<snip>

> there are a lot of really great texts out there for scripting. i MUST
> recommend "A Practical Guide to Linux: Commands, Editors, and Shell
> Programming" by Mark G. Sobell (of the Sobell publishing house, i
> believe), as well as "Linux Shell Scripting with Bash" by Ken O.
> Burtch.
>
> the former is a HUGE tome, filled with excercises and summaries and
> reviews. the latter is a smaller book but focused more on actual
> scripting theory.

I would *personally* recommend:

	Learning the bash Shell3 (LtbS3)
		http://www.oreilly.com/catalog/bash3/index.html
	Classic Shell Scripting (CSS)
		http://www.oreilly.com/catalog/shellsrptg/
	bash Cookbook
		http://www.oreilly.com/catalog/9780596526788/index.html

As some of you know, I'm an O'Reilly book bigot--I just love their books, especially the Cookbook and Hacks series.

Also, in the interest of full disclosure, I wrote about 48% of the _bash Cookbook_... :-)

LtbS3 is the intro. CSS is kind of intermediate, though it also branches out to other tools and shells (besides bash), which is a good thing. And the cookbook is just that, a cookbook. It won't help you learn in any kind of step-by-step way, but if you are the kind who'd rather learn by example you can do that. Or if you just want the answer, or something "close enough;" that's what it's for.

Having said that, we don't really cover "backups" in any specific way, though lots of the bits and pieces will apply to parts of the backup problem.


On a personal note, I used to do a lot of DOS (yes DOS) and Windows batch files, which in the Unix/Linux world are called shell scripts. Same thing, slightly different name. command.com and later cmd.exe are really terribly bug ridden and inconsistent. They drive me crazy when I still have to do anything in them, as the simplest things are so hard and so awkward.


My favorite pet peeve (if that's not an oxymoron) is getting the output of some external tool into a variable. In Unix/Linux this is trivial"
somevar=`external_tool -foo -bar baz`
--OR, the newer, more readable and nestable way--
somevar=$(external_tool -foo -bar baz)


In Windows cmd.exe, it's:
	for /f %%x in ('external_tool -foo -bar baz') do set somevar=%%x

See http://www.jpsdomain.org/windows/winshell.html for more.

I'd love to say that for anything non-trivial on Windows, use Perl. But I can't because it's not built-in like cmd.exe is. Also, I have not explored Monad, err, I mean PowerShell, but from the examples I've seen it looks like it combines all the worst traits of Java and C++.


Shutting up now... JP ----------------------------|:::======|------------------------------- JP Vossen, CISSP |:::======| jp{at}jpsdomain{dot}org My Account, My Opinions |=========| http://www.jpsdomain.org/ ----------------------------|=========|------------------------------- Microsoft has single-handedly nullified Moore's Law. Innate design flaws of Windows make a personal firewall, anti-virus and anti-malware software mandatory. The resulting software arms race has effectively flattened Moore's Law on hardware running Windows. ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug