View Single Post
  #7   (View Single Post)  
Old 30th September 2011
raindog308 raindog308 is offline
Fdisk Soldier
 
Join Date: Sep 2011
Posts: 67
Default

I like Chris F.A. Johnson's "Shell Scripting Recipes", though I don't recall at this moment which shell it discusses.

Personally, I would say that shell programming knowledge develops in these stages:

1. A list of commands executed in sequence

2. Same as #1 but verbosely telling the user what's doing and maybe writing to a log file

3. A situation where you might want something to happen, so you learn about if and maybe case

4. You realize you need to consider some input more deeply, so you need to learn basic text processing (cut, sed, maybe simple awk) and variables

5. You decide to make your program somewhat interactive so there's user processing

6. Very soon after, you learn more about error handling because users make mistakes :-)

7. Your programs get bigger and now you're into functions, little libraries, etc. You are using variable scoping, coroutines, arrays, and lots more awk, sed, etc. Maybe you go crazy and start using tput to write interactive curses menus :-)

8. You've outgrown shell and move on to perl, python, ruby, or really move on and start writing C.

I am not entirely serious about #8. I've maintained multi-thousand-line shell scripts and with enough programmer discipline, you can write huge things in shell.
Reply With Quote