- scripts are usually setup in the same manner - below is a checklist and boiler plate for shell scripts
- Verify the Shebang is at the top
- Add comments defining the purpose of the script
- Define your global variables
- Define your functions and use local variables in the functions
- Define the main logic of the script
- Exit the script with an exit status (the exit status can also be defined in other areas of the script)
#!/bin/bash
#
# <Replace with the description and/or purpose of this shell script.>
GLOBAL_VAR1="one"
GLOBAL_VAR2="two"
function function_one() {
local LOCAL_VAR1="one"
# <Replace with function code.>
}
# Main body of the shell script starts here.
#
# <Replace with the main commands of your shell script.>
# Exit with an explicit exit status.
exit 0