Shell: files and arrays

- if you want to process an array

ARR="uno due tre"
for i in ${ARR}
do
      echo $i
done

- if you want to read the file file.txt line by line

for f in `cat mynamesfile.txt`
   do
       echo " 'user' = '${f}';"
   done

- if you want to read the file file.txt line by line

while read line
do
    echo $line
done <file.txt


return to gimbo wiki home page