#] #] ********************* #] $ bash "$d_SysMaint"'Linux/while loop notes.txt' www.BillHowell.ca 24Jul2019 initial see also "file read loops.txt" # view in text editor, using constant-width font (eg courier), tabWidth = 3 08********08 #] read single file #] while IFS='' read -u 9 pInn329; do #] echo "$pInn329" | sed 's|search|replace|' >"$pOut329" #] done 9<"$pInnL329" #] 08********08 #] read coordinated files #] while IFS='' read -u 9 strCdeSearch329 && read -u 8 -r strCdeReplac329; do #] echo "$strCdeSearch329"$'\t'"$strCdeReplac329" >"$pCdeStrPRes329" #] done 9<"$pCdeSearch329" 8<"$pCdeReplac329" #] 08********08 #] 15Apr2022 simplest while loop #] while [[ 1 == "$flag_loop" ]] #] do #] ... #] done #] ************** #] 24Jul2019 while with an if break https://linuxize.com/post/bash-while-loop/ November 25, 2018 In the following example, the execution of the loop will be interrupted once the current iterated item is equal to 2. #] i=0 #] while [ $i -lt 5 ] #] do #] echo "Number: $i" #] ((i++)) #] if [[ "$i" == '2' ]]; then #] break #] fi #] done #] echo 'All Done!' #] # enddoc