A basic template is the following:
Code:
#!/bin/sh
set -evx
# your script with comments ...
exit ( 0 );
Once it is working, you can remove the
set -v -x and leave the
set -e. See the man page for "sh" for details on
set on the others but the
-e will cause the script to quit if it encounters any errors that are not planned for.
You can leave in the various && operators if you like, but in some cases replacing them with if-then or if-then-else will be more readable.
If you are wondering where to store the script once you have it working, you can put it in
/usr/local/sbin/ if it is a local system administration script.