Skip to content

c4arl0s/while

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

  1. 1. Arithmetic
  2. 2. filesystem-related conditions
  3. 3. or for reading input
  4. 4. Elegant endless loop
  5. 5. Modify variable inside a while loop
while (( COUNT < MAX ))
do
    some stuff
    let COUNT++
done
while [ -z "$LOCKFILE" ]
do
    some things
done

You can pass standard output to these lines:

while read lineoftext
do
    process $lineoftext
done

Uff really elegant

while : ## Elegant Endless loop
do
    echo "Do something"
done
#/bin/bash

# Inside while loop will not be modified variable movie
echo "First time"
movie=""
echo ${movie}
cat movies.txt | cut -d "." -f 2 | while read movie_name; do
  if echo "${movie_name}" | grep "Kid"; then
    movie="${movie_name}"
  fi
done
echo "${movie}"

echo "Second time"
while IFS= read -r movie_name; do
  if echo "${movie_name}" | grep "Kid"; then
    movie="${movie_name}"
  fi
done < movies.txt

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages