开发者

on the fly debug of BASH or SHELL scripts, pause inside loops

开发者 https://www.devze.com 2023-02-11 09:22 出处:网络
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:

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

0

精彩评论

暂无评论...
验证码 换一张
取 消