while read line
do
echo "$line"
done < list-of-dirs.txt
or
while read line
do
echo "$line"
do
command1 on $line
command2 on $line
..
....
commandN
done < "/path/to/filename"
while IFS= read -r field1 filed2 field3 ... fieldN
do
command1 on $field1
command2 on $field1 and $field3
..
....
commandN on $field1 ... $fieldN
done < "/path/to dir/file name with space"
"IFS is used to set field separator (default is while space). The -r option to read command disables backslash escaping (e.g., \n, \t). This is failsafe while read loop for reading text files."
No comments:
Post a Comment