Tuesday, 18 November 2008

How to read a text file into a command

so you have a text file (users.txt) and you want to read that into a script that prints out the users status using the getent command

while read line
do
getent passwd | $line
done < users.txt

and thats it!

No comments: