"Bash while"의 두 판 사이의 차이

32번째 줄: 32번째 줄:
* [[Bash for]]
* [[Bash for]]
* [[Bash 파일 한줄씩 읽기]]
* [[Bash 파일 한줄씩 읽기]]
* [[리눅스 무한반복 스크립트 repeat.sh]]
* [[while]]
* [[while]]


[[category: bash]]
[[category: bash]]

2019년 9월 9일 (월) 14:47 판

1 개요

Bash while
x=1
while [ $x -le 3 ]; do
  echo "x = $x"
  x=$(( $x + 1 ))
done
# x = 1
# x = 2
# x = 3
i=1
while [ $i -lt 4 ]; do
   echo "i = $i"
   i=`expr $i + 1`
done
# i = 1
# i = 2
# i = 3
while true; do echo hello; sleep 1; done
# hello
# hello
# ...

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}