I wrote a shell script and every time when I want print the executed commands and arguments I used the “echo” to echo the executed commands, this is not convenient. At the same time I use my co-worker’s shell script, I found that his script print a lot of useful infomation which including executed commands and arguments. I saw the shell code and very surprise there is a few echo. I’m not familar with shell but found that he used “set -x” at every script begining. So I google the “set -x”:
set -x: Prints executed commands and their arguments
For me, one “set -x” can replace of many “echo”s and it seems that I should learn the shell scrpit systematic, “Learning the bash Shell, Third Edition” may be the best choice for me:
This refreshed edition serves as the most valuable guide yet to the bash shell. It’s full of practical examples of shell commands and programs guaranteed to make everyday use of Linux that much easier. Includes information on key bindings, command line editing and processing, integrated programming features, signal handling, and much more!
Posted by 52nlp
Related posts:
- How to start new process or run shell commands within python?
- Moses Support Digest:The results of your email commands
- Two methods to redirect output for “set -x”
- Moses Support Digest:moses decoder results on cygwin and dos
- “Nohup” and “Screen”
- Error “join: multi-character tab `\\t’” for using join tab
- Moses Support Digest:mert extractor