Re: bash : "while :"

トップ ページ

このメッセージに返信
著者: nt.guilde
日付:  
CC: guilde
題目: Re: bash : "while :"
>while :
>do
>        _end=`wc -l < "${_file}"`
>        _end="${_end##* }"
>        if (( ${_end} > ${_start} ))
>        then
>                _start=$(($_start + 1 ))
>                sed -n "${_start},${_end}p" "${_file}" | grep "${_pat}" >> 
>$LOG
>                _start=${_end}
>        fi
>        sleep 1
>done

>
>Je n'arrive pas à comprendre ce que cela fait ce "while :"
>Le ":" correspond à quoi?


Il correspond a` 'while (1)' en C.

man bash | less -p'^ *:'

       : [arguments]
              No  effect;  the command does nothing beyond expanding arguments
              and performing any specified redirections.  A zero exit code  is
              returned.


(sed peut faire le travail de grep :

sed "${_start},${_end}!d; /${_pat}/!d" >>$LOG)

-Nicolas

--
"The position taken by the Scots and the English take regarding their
relations is very certainly none of your affair - you insignificant
little frog-eating chancer." -Charles Walmsley