Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

bash while true

while :; do
  # loop infinitely
done
Comment

while loop bash

while true;
do
	#code
done
Comment

shell script while loop example

#!/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
Comment

while loop shell script

#!/bin/sh

a=0

while [ $a -lt 10 ]
do
   echo $a
   a=`expr $a + 1`
done
Comment

bash while loop

#!/bin/bash
i=0
While [ $i -le 10 ]
do
 echo i:$i
 ((i+=1))
done
Comment

bash while done

while CONDITION_STATEMENT; do SOME_CODE; done
Comment

While loops in bash

#!/bin/bash
X=0
while [ $X -le 20 ]
do
	echo $X
	X=$((X+1))
done
Comment

for while bash

Use for in bash for iterating words in a string or values in an array as:
for value in {1, 2, 3}; do echo $value; done
for value in $(cat arguments_files.txt); do [some_command]; done
And use while for iterating lines from a pipe output as:
cat arguments_file.txt | while read line; do [some_command]; done
Comment

bash while

#!/bin/bash
counter=$1
factorial=1
while [ $counter -gt 0 ]
do
   factorial=$(( $factorial * $counter ))
   counter=$(( $counter - 1 ))
done
echo "$factorial"
Comment

linux while loop shell

while ! [ "${finished}" ]; do
    ...
done
Comment

linux while loop shell

finished=false
while ! $finished; do
    ...
    # At some point
    finished=true
done
Comment

linux while loop shell

while [ "$finished" != "true" ]; do
   ...
done
Comment

bash do-while

while : ; do 
    ACTION_CODE
    [[ CONDITION_STATEMENT ]] || break
done
Comment

bash run while loop

while true; do echo -e "
new proccess"; php artisan queue:work --once; done
Comment

PREVIOUS NEXT
Code Example
Shell :: set date and time linux 
Shell :: ubuntu visual studio path 
Shell :: pip upgrade all 
Shell :: how to install xdebug on Windows 
Shell :: apt list only security updates 
Shell :: git view changes in commit 
Shell :: install aws cli on windows 
Shell :: minimize on click in ubuntu dock 
Shell :: cmd rename multiple files 
Shell :: git pull shows already up to date 
Shell :: remove all folder except one linux 
Shell :: npm install in dev mode 
Shell :: install pip archlinux 
Shell :: git remote using ssh 
Shell :: linux mv all folder to previous folder 
Shell :: commmand for installing tailwind to react 
Shell :: how to check if helm is installed 
Shell :: how to install edge throught terminal ubuntu 
Shell :: lib cairo win64 installation 
Shell :: ufw allow port from ip 
Shell :: copier un répertoire et son contenu sous linux 
Shell :: install brew on mac m1 
Shell :: postgres setup Linux Debian 
Shell :: Installing the virtualenv for you app 
Shell :: install jenkins in linux 
Shell :: bash split line and get element 
Shell :: git tutorial remove branches on local that do not exist on remote 
Shell :: migrate has no installation candidate 
Shell :: install chromedriver on linux 
Shell :: : keyserver receive failed: No dirmngr 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =