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

 
(사용자 2명의 중간 판 2개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;Bash while
;Bash while
;리눅스 while


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


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

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