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

 
3번째 줄: 3번째 줄:
;리눅스 while
;리눅스 while


<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash' run>
x=1
x=1
while [ $x -le 3 ]; do
while [ $x -le 3 ]; do
9번째 줄: 9번째 줄:
   x=$(( $x + 1 ))
   x=$(( $x + 1 ))
done
done
# x = 1
# x = 2
# x = 3
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash' run>
i=1
i=1
while [ $i -lt 4 ]; do
while [ $i -lt 4 ]; do
19번째 줄: 16번째 줄:
   i=`expr $i + 1`
   i=`expr $i + 1`
done
done
# i = 1
# i = 2
# i = 3
</syntaxhighlight>
</syntaxhighlight>
<syntaxhighlight lang='bash'>
<syntaxhighlight lang='bash'>

2021년 4월 14일 (수) 15:48 기준 최신판

1 개요[ | ]

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

2 같이 보기[ | ]

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