Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

foreach bash

for n in $(cat lists.txt )
do
    echo "Working on $n file name now"
    # do something on $n below, say count line numbers
    # wc -l "$n"
done

#################

input="lists.txt"
 
## Let us read a file line-by-line using while loop ##
while IFS= read -r line
do
  printf 'Working on %s file...
' "$line"
done < "$input"
Source by www.cyberciti.biz #
 
PREVIOUS NEXT
Tagged: #foreach #bash
ADD COMMENT
Topic
Name
7+9 =