Bash programming methodology
IBM Developerworks had an article about bash functions. I found this little ditty tucked in the article and I liked it.
These basic steps and recommendations can be applied to many client/server applications that run in Linux.
Document the prerequisites and main sequence for running scripts
Divide actions into logical groups
Develop an execution sequence based on a common usage scenario
Provide comments and instructions in each shell script
Make an initial backup to create a baseline
Check for input parameters and environment variables
Try to provide "usage" feedback
Try to provide a "silent" running mode
Provide one function to terminate the script when there are errors
When possible, provide functions that do a single task well
Capture the output of each script, while watching the output being produced
Inside each script, capture the return code of each line command
Keep a count of the failed transactions
Highlight the error messages for easy identification in the output file
When possible, generate files "on the fly"
Provide feedback on the progress of the execution of the script
Provide a summary of the execution of the script
Try to provide an output file that is easy to interpret
When possible, provide cleanup scripts and a way to return to the baseline
- Document the prerequisites and main sequence for running scripts
- Divide actions into logical groups
- Develop an execution sequence based on a common usage scenario
- Provide comments and instructions in each shell script
- Make an initial backup to create a baseline
- Check for input parameters and environment variables
- Try to provide "usage" feedback
- Try to provide a "silent" running mode
- Provide one function to terminate the script when there are errors
- When possible, provide functions that do a single task well
- Capture the output of each script, while watching the output being produced
- Inside each script, capture the return code of each line command
- Keep a count of the failed transactions
- Highlight the error messages for easy identification in the output file
- When possible, generate files "on the fly"
- Provide feedback on the progress of the execution of the script
- Provide a summary of the execution of the script
- Try to provide an output file that is easy to interpret
- When possible, provide cleanup scripts and a way to return to the baseline
IBM Developerworks had an article about bash functions. I found this little ditty tucked in the article and I liked it.
These basic steps and recommendations can be applied to many client/server applications that run in Linux.
Document the prerequisites and main sequence for running scripts
Divide actions into logical groups
Develop an execution sequence based on a common usage scenario
Provide comments and instructions in each shell script
Make an initial backup to create a baseline
Check for input parameters and environment variables
Try to provide "usage" feedback
Try to provide a "silent" running mode
Provide one function to terminate the script when there are errors
When possible, provide functions that do a single task well
Capture the output of each script, while watching the output being produced
Inside each script, capture the return code of each line command
Keep a count of the failed transactions
Highlight the error messages for easy identification in the output file
When possible, generate files "on the fly"
Provide feedback on the progress of the execution of the script
Provide a summary of the execution of the script
Try to provide an output file that is easy to interpret
When possible, provide cleanup scripts and a way to return to the baseline
- Document the prerequisites and main sequence for running scripts
- Divide actions into logical groups
- Develop an execution sequence based on a common usage scenario
- Provide comments and instructions in each shell script
- Make an initial backup to create a baseline
- Check for input parameters and environment variables
- Try to provide "usage" feedback
- Try to provide a "silent" running mode
- Provide one function to terminate the script when there are errors
- When possible, provide functions that do a single task well
- Capture the output of each script, while watching the output being produced
- Inside each script, capture the return code of each line command
- Keep a count of the failed transactions
- Highlight the error messages for easy identification in the output file
- When possible, generate files "on the fly"
- Provide feedback on the progress of the execution of the script
- Provide a summary of the execution of the script
- Try to provide an output file that is easy to interpret
- When possible, provide cleanup scripts and a way to return to the baseline