bash - Loop through list of names and copy file explained? -
i've written script copy new user account file new user location. works reading list of usernames , copying file location. can't understand why needed done < $user
@ end. can please explain this?
thanks
user=/home/example/new.txt newuser=$user loc=/var/account/ cd /home/example while read newuser cp _newuser.txt $loc/$newuser done < $user
to iterate on each line in file /home/example/new.txt
, value of variable user
pls @ http://en.kioskea.net/faq/1757-how-to-read-a-file-line-by-line
<
input redirection
operator (http://www.tldp.org/ldp/abs/html/io-redirection.html)
you can delete newuser=$user
, since not see use of newuser
except while
loop. due while
, newuser
assigned new value each iteration.
Comments
Post a Comment