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

잔글 (봇: 자동으로 텍스트 교체 (-source +syntaxhighlight))
2번째 줄: 2번째 줄:
;Bash while
;Bash while


<source lang='bash'>
<syntaxhighlight lang='bash'>
x=1
x=1
while [ $x -le 3 ]; do
while [ $x -le 3 ]; do
11번째 줄: 11번째 줄:
# x = 2
# x = 2
# x = 3
# x = 3
</source>
</syntaxhighlight>
<source lang='bash'>
<syntaxhighlight lang='bash'>
i=1
i=1
while [ $i -lt 4 ]; do
while [ $i -lt 4 ]; do
21번째 줄: 21번째 줄:
# i = 2
# i = 2
# i = 3
# i = 3
</source>
</syntaxhighlight>
<source lang='bash'>
<syntaxhighlight lang='bash'>
while true; do echo hello; sleep 1; done
while true; do echo hello; sleep 1; done
# hello
# hello
# hello
# hello
# ...
# ...
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 11월 2일 (월) 02:37 판

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 }}