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

(새 문서: ==개요== ;Bash while <source lang='bash'> x=1 while [ $x -le 3 ]; do echo "x = $x" x=$(( $x + 1 )) done # x = 1 # x = 2 # x = 3 </source> <source lang='bash'> i=1 while [ $i -lt...)
 
 
(사용자 2명의 중간 판 6개는 보이지 않습니다)
1번째 줄: 1번째 줄:
==개요==
==개요==
;Bash while
;Bash while
<source lang='bash'>
;리눅스 while
 
<syntaxhighlight lang='bash' run>
x=1
x=1
while [ $x -le 3 ]; do
while [ $x -le 3 ]; do
7번째 줄: 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
17번째 줄: 16번째 줄:
   i=`expr $i + 1`
   i=`expr $i + 1`
done
done
# i = 1
</syntaxhighlight>
# i = 2
<syntaxhighlight lang='bash'>
# i = 3
while true; do echo hello; sleep 1; done
</source>
# hello
# hello
# ...
</syntaxhighlight>


==같이 보기==
==같이 보기==
* [[Bash for]]
* [[Bash for]]
* [[Bash 파일 한줄씩 읽기]]
* [[리눅스 무한반복 스크립트 repeat.sh]]
* [[while]]
* [[while]]


[[category: bash]]
[[category: 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 }}