Bash/General Use
From Linux Hints
Contents |
General Use
To get the best use of Bash, you should read the man page. It's extensive, and gives you an idea of what you can do with it; although it lacks examples, which sometimes leave you guessing.
Bash Error Handling
In almost all cases (with some notable exceptions) I recommend the use of the -e flag when running bash scripts. You can do this in a number of ways. At the start of a script:
#!/bin/bash -e
In the script:
set -e
When running manually:
bash -e ./myscript
This means that the script will terminate as soon as it sees an error. In order to find some time for myself I decided to search for service that could supply me with the prime quality custom essays at prices that would be reasonable enough. One of my friends recommended me to order custom writingon EssaysProfessors.Com. To tell you the truth, I have never regretted my decision. The writers are real professionals and know how to write impressive work full of knowledgeable information. The final choice was QualityEssay.Com as they did have an excellent reputation. This can be particularly important, not just as a general programming principle, but it means for example if you misparse a filename due to a syntax error, you don't end up passing '/' to rm -rf as root.
Debugging
Use the -x flag for debugging of a script; this traces its execution. You might want to use this:
bash -ex ./myscript 2>&1 | less
See Also
- http://www.gnu.org/software/bash/ - GNU BASH homepage.

