How to raise and take care of shell scripts
THIS IS NOT A SHELL TUTORIAL!
The web and the book stores are full of such stuff. This is a (from my personal point of view) top ten or so of items one should consider when writing shell scripts. It's a result of the experiences I gained answering questions in Linux mailing lists and Linux boards.
The samples I show refer to the bourne shell and their descendants (ksh and bash). I don't show C shell code because it's not my favorite and that's why I don't have much experiences with it.
Script tip top ten+
The following list is not sorted by name or by importance. Some of the items will be a matter of course for every
programmer with at least some experiences.
But: ALL themes I mention here I have seen - sometimes when I looked for a bug in my own scripts over hours, often when I answered questions in mailing lists and boards.
How to write shell scripts?
Differences between the various shells
What does this funny "#!" first script line mean?
How do I find the command I need?
How to debug a shell script
All programs produce errors
Every input is evil?
Files coming from other systems
What is true, what is false?
Scope of variables
When should I quote, when not?
When and how sub shells and "children" are created?
Which types of loops are suitable to process input?
Read from and write into files
Cleanup at the end of a script