Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

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

for loop while loop shell functions

while check1
do
    # Loop while check1 is successful (returns 0)

    if check1
    then
        echo 'check1 was successful'
    fi

done
Comment

While loops in bash

#!/bin/bash
X=0
while [ $X -le 20 ]
do
	echo $X
	X=$((X+1))
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

PREVIOUS NEXT
Code Example
Shell :: bash scripts options without arg 
Shell :: docker compose plugin 
Shell :: git ignore all files within a directory 
Shell :: pterodactyl installer 
Shell :: linux get user uid 
Shell :: how to create a text file in batch 
Shell :: bash run a command every x second 
Shell :: move files one level up linux 
Shell :: error after docker uninstall 
Shell :: install golang ubuntu 
Shell :: get current user debian 
Shell :: .gitignore is not ignoring directories 
Shell :: install zip raspberry pi 
Shell :: list all node versions mac 
Shell :: vscode tab not working ubuntu windows 
Shell :: block comment bash 
Shell :: taskbar directory windows 
Shell :: how to set execute permission in linux 
Shell :: ngrok download authtoken 
Shell :: kubectl get namespace 
Shell :: is lubuntu better than ubuntu 
Shell :: git version 
Shell :: how to still atom on ubuntu 
Shell :: ubuntu find file 
Shell :: git push specific ssh key 
Shell :: ts-node not found 
Shell :: unix set current time in file name 
Shell :: uninstall dependencies yarn 
Shell :: vendor/autoload.php download 
Shell :: install ftp on ubuntu 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =