I recently erased part of my home directory with a shell script I wrote. Fortunately, I did hit Ctrl-C fast enough to avoid the worst.
My mistake has been to rely too much on relative paths. Since now, I always use absolute paths when changing directory... But, it lead me to an interesting question: What are the rules to write robust shell scripts ?
I already know that one should always use absolute paths when moving to from a directory to another. But, there must be plenty others (for example, what to do when a command fail, what is a nice way to stop the script and inform the user about it).
So, does anyone have a list of such a rules and hints specifically targeted for shell scripts?