在调试模式中,使用bash运行脚本

・2 分钟阅读

在调试模式下运行bash脚本

bash -x ./post_to_commandlinefu.sh
示例输出
bash -x ./post_to_commandlinefu.sh bash -x ./post_to_commandlinefu.sh 
+ COMMAND='bash -x ./post_to_commandlinefu.sh'
+ echo 'command is bash -x ./post_to_commandlinefu.sh'
command is bash -x ./post_to_commandlinefu.sh
+ '[' 'bash -x ./post_to_commandlinefu.sh' = '' ']'
+ SESSIONFILE=./.c
+ LOGINURL=http://www.commandlinefu.com/users/signin
+ EDITURL=http://www.commandlinefu.com/commands/edit
++ dirname ./.c
++ basename ./.c
+ find . -name .c -mtime +1 -exec rm '{}' ';'
+ '[' '!' -f ./.c ']'
+ echo -n 'Enter commandlinefu username: '
Enter commandlinefu username: + read USERNAME
+ echo -n 'Enter commandlinefu password: '
Enter commandlinefu password: + read -s PASSWORD
+ echo
+ wget -O - --save-cookies ./.c --keep-session-cookies --post-data 'username=&password=&remember=on&submit=Let me in!' http://www.commandlinefu.com/users/signin
+ echo -n 'Enter summary (required): '
Enter summary (required): + read SUMMARY
runs a bash script in debugging mode
++ echo runs a bash script in debugging mode
++ cut -c1-154
+ SUMMARY='runs a bash script in debugging mode'
++ echo bash -x ./post_to_commandlinefu.sh
++ cut -c1-254
+ COMMAND='bash -x ./post_to_commandlinefu.sh'
+ echo 'post-data is command=bash -x ./post_to_commandlinefu.sh&summary=runs a bash script in debugging mode&submit=Save'
post-data is command=bash -x ./post_to_commandlinefu.sh&summary=runs a bash script in debugging mode&submit=Save
+ wget -O - --load-cookies ./.c --post-data 'command=bash -x ./post_to_commandlinefu.sh&summary=runs a bash script in debugging mode&submit=Save&' http://www.commandlinefu.com/commands/edit
+ rm -f browse edit
+ rm -f '*17274*'
Hujiuxiang profile image