• 追加された行はこの色です。
  • 削除された行はこの色です。
* ループ [#ncb301b8]
** for [#r8645c66]
 IFS='
 '
 for line in `cat /etc/passwd`; do
    echo $line
 done

*** continue [#g60344ea]
 for x in 1 2 3; do
    if [ "$x" = "2" ]; then
      continue
    fi
    echo $x
 done

 1
 3

*** ループ内処理の結果をファイルへリダイレクトする [#a5e4636a]
 for n in 1 2 3; do
    echo DEBUG: $n
 done >> num.txt


** while [#vfdd2bd5]
引数
*** 引数処理 [#v6a4eab9]
 while [ $# -gt 0 ]; do
    echo $1
    shift
 done
カウントダウン

*** カウントダウン [#j74d5e1f]
 try=10
 while [ "$try" -gt 0 ]; do
    try=`expr "$try" - 1`
 done

** readコマンドを使って入力を読み取る [#x6115b9a]
 cat /etc/passwd | while read line; do
     echo $line    
*** breakで抜ける [#n38fe618]
 while : ; do
    if date '+%S' | grep '00'; then
        echo hit
        break
    fi
    echo -n .
    sleep 1
 done


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS