on the fly debug of BASH or SHELL scripts, pause inside loops
When writing python scripts, I sometimes a quick look into loops, while pdb is great sometimes it is easeir for me to just print the value of a variable, and put a pause like statement after that:
print SomeVariable
raw_input("\n\nPress the enter key to exit.")
How can I do something similar 开发者_如何转开发in BASH scripts ? I would like to pause inside a while loop, and so far I am puzzled:
while read myline
do
id $myline
#here should be a PAUSE
echo -p "Type enter to continue"
done < userNames
help would be appreciated
you are use read
eg
read -p "Please enter"
if you want to debug your shell script, you can use set -x
in your script, or run bash
with -x
精彩评论