- バックアップ一覧
- 差分 を表示
- 現在との差分 を表示
- バックアップ を表示
- シェルスクリプト/文法/Bashオプション/xオプションでデバッグ へ行く。
- 1 (2012-01-26 (木) 18:05:19)
* bashのxオプションでデバッグ [#g652a4a3] こんなスクリプト test.sh があったとして、 #!/bin/bash dir="/home/taro/tmp/" files=$(ls -1 $dir); IFS=' ' for f in $files; do echo "FILE: " $f done xオプションを付けてスクリプトを実行すると、 $ bash -x test.sh 変数の中身が確認できる。 + dir=/home/taro/tmp/ ++ ls -1 /home/taro/tmp/ + files='1.txt 2.txt 3.txt' + IFS=' ' + for f in '$files' + echo 'FILE: ' 1.txt FILE: 1.txt + for f in '$files' + echo 'FILE: ' 2.txt FILE: 2.txt + for f in '$files' + echo 'FILE: ' 3.txt FILE: 3.txt