bash スクリプト debug デバッグ
スクリプトの文法をチェックする。
#!/bin/bash -n
スクリプトの実行コマンドを表示させる。
#!/bin/bash -v
こっちの方がいい
set -x : Display commands and their arguments as they are executed.
set -v : Display shell input lines as they are read.
http://www.cyberciti.biz/tips/debugging-shell-script.html
変数を表示する
$ array=('Take it' easy)
$ declare -p array
declare -a array='([0]="Take it" [1]="easy")'
$
#!/bin/bash
# Display commands and their arguments as they are executed.
set -x
# Display shell input lines as they are read.
#set -v
ls $HOME/*gz
set +x
#set +v
ls $HOME/*gz
exit 0
登録:
コメントの投稿 (Atom)
0 件のコメント:
コメントを投稿