Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

read file and while loop example

#!/bin/sh
while read input_text
do
  case $input_text in
        hello)          echo English    ;;
        howdy)          echo American   ;;
        gday)           echo Australian ;;
        bonjour)        echo French     ;;
        "guten tag")    echo German     ;;
        *)              echo Unknown Language: $input_text
                ;;
   esac
done < myfile.txt
Source by www.shellscript.sh #
 
PREVIOUS NEXT
Tagged: #read #file #loop
ADD COMMENT
Topic
Name
6+2 =