This post originated from an RSS feed registered with Java Buzz
by Jason Sankey.
Original Post: Bash Tip: Tracing Execution
Feed Title: a little madness
Feed URL: http://www.alittlemadness.com/feed/
Feed Description: A man needs a little madness, or else he never dares cut the rope and be free. -Nikos Kazantzakis
When your bash script is going haywire, and you’re having trouble sorting out why, one of the simplest ways to see what is going on is to use:
set -x
This turns on the xtrace shell option, which prints the commands the shell is executing with expanded arguments, as they are executed. From the man page:
-x [...]