Answered by : venkatesh
#!/bin/sh
INPUT_STRING=hello
while [ "$INPUT_STRING" != "bye" ]
do echo "Please type something in (bye to quit)" read INPUT_STRING echo "You typed: $INPUT_STRING"
done
Source : https://www.shellscript.sh/loops.html | Last Update : Sat, 15 May 21
Answered by : wantyapps
while true;
do #code
done
Source : https://stackoverflow.com/questions/16489809/emulating-a-do-while-loop-in-bash | Last Update : Sat, 30 May 20
Answered by : breakable-bison-slugdvxuz87h
#!/bin/sh
a=0
while [ $a -lt 10 ]
do echo $a a=`expr $a + 1`
done
Source : https://www.tutorialspoint.com/unix/while-loop.htm | Last Update : Thu, 12 Nov 20
Answered by : agenttequila
#!/bin/bash
i=0
While [ $i -le 10 ]
do echo i:$i ((i+=1))
done
Source : https://hakin9.org/bash-introduction-for-hackers-part-2/ | Last Update : Thu, 02 Jun 22
Answered by : adventurous-addax-z62mj3vc4dnv
while check1
do # Loop while check1 is successful (returns 0) if check1 then echo 'check1 was successful' fi
done
Source : https://stackoverflow.com/questions/27674687/in-bash-script-how-to-call-function-in-while-loop-condition | Last Update : Sun, 01 Nov 20
Answered by : cl
{"tags":[{"tag":"textarea","content":"#!\/bin\/bash\n\ncount=0\n\nwhile [ $count -lt 10 ]\n do\n (( count++ ))\n echo $count\n done","code_language":"shell"}]}
Source : https://itnext.io/bash-using-loops-for-while-until-with-examples-f519eda7f41b | Last Update : Sat, 28 Jan 23
Answered by : 4a729krishnaa
#!/bin/bash
X=0
while [ $X -le 20 ]
do echo $X X=$((X+1))
done
Source : http://www.panix.com/~elflord/unix/bash-tute.html | Last Update : Wed, 07 Sep 22