ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

Bourne / Bash Shell Scripting Resources

(1/6) > >>

Started to work through:

  Steve's Bourne / Bash shell scripting tutorial

Encountered this associated quote:

Doug Kramer (Java, says:
"When I started writing CGI script in Bourne shell on the Java team at Sun, I scoured the Internet for a good tutorial and used Steve Parker's guide, which I really like. Now that I've moved to Google and switched to Linux and bash, I've decided to use it as the basis for an in-house introductory course on bash scripting here at Google for our tech writers. I highly recommend it as accurate and written at the right level, plus it includes a useful reference"

--- End quote ---

CGI scripts in Bourne shell?  Doesn't sound terribly pleasant!

Not a huge fan of shell scripting, but figured it couldn't hurt to be able to read / understand existing code.

Any one have any related favorite resources?

I never got into CGI except in the most superficial way(like finding out what it is.)  On Windows the best use I found for bash was to enable use of Linux utilities on Win32.  There are stand-alone exe ports of Linux tools for Win32 but you can really string the commands together out of a bash shell in Windoze.  You can do all those cool command substitute tricks with "find" results etc..

By using the bash shell you side step many of the problems such as cmd.exe eating characters that Linux commands use for special purposes.

One resource may be the bargain bin if you have a brick & mortar computer book store nearby.  Since bash is a superset of sh shell, many of the old example sh scripts still work.  I used to have a $9 "in a nutshell" book with many example sh scripts.. but I can't seem to find it to get the exact title.

For me a rudimentary knowledge of bash was required to control Linux startup.  If you are on a Linux server such as Apache then it couldn't hurt to know some bash.  I looked on some of the online book sites but didn't see a cover that looked like my nutshell book. I guess my info is dated. But with unix based systems esp. old scripting code often still works with a couple of tweaks.  The basic system doesn't change all that much. Most of the scripts for the system are still under /etc etc.. :)

Start small, work your way up.
The last two links I have printed hard copies of:

Getting Started with BASH by Scott Rippee:

BASH Programming - Introduction by Mike G

Advanced BASH Scripting by Mendel Leo Cooper:

BASH Reference Manual by Chet Ramey and Brian Fox:


Thanks for the comments and suggestions  :Thmbsup:

The Learn About Bash Scripting section of the suggested Getting Started with BASH turned up "Bash by example..." (3 parts).  Perhaps somewhat in line with "starting small", am considering "Part 1" as an entry point before attempting some of the suggestions :)

FWIW, I found alternate (possibly updated but not maintained) versions at:

* Bash by example, Part 1
* Bash by example, Part 2
* Bash by example, Part 3
Some headers:

Part 1
  You're already running it
  You're already using it
  Bash confusion
  Environment variables
  Chopping strings overview
  Command substitution
  Chopping strings like a pro
  Applying string chopping
  if statements
  Next time

Part 2
  Accepting arguments
  Bash programming constructs
  Conditional love
  String comparison caveats
  Looping constructs: "for"
  Shell arithmetic
  More looping constructs: "while" and "until"
  Case statements
  Functions and namespaces
  Wrapping it up

Part 3
  Enter the ebuild system
  Why bash?
  Build process review
  Generalizing the code
  Adding functionality
  Modularizing the code
  Configuration files
  Wrapping it up

Looks like part 3 may be gentoo-specific...

Are you running a Linux system?  If so look through the start up scripts in /etc and see how they do what they do.  The XWindow manager applets usually just pass some params to one of those scripts.


[0] Message Index

[#] Next page

Go to full version