<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 09/12/2013 08:35 AM, leam hall
wrote:<br>
</div>
<blockquote
cite="mid:CACv9p5qLfJ5dvOysOkmYws-d1wOxJ0-Nb3nWTq-fQO49+0yRiA@mail.gmail.com"
type="cite">
<div>
<div>
<div>while read UID GID COMMENT<br>
</div>
do<br>
</div>
echo UID is $UID, GID is $GID, and it's $COMMENT"<br>
</div>
done < grep person /etc/passwd | awk -F":" '{ print $3, $4, $5
}'</blockquote>
<br>
I put this in a script and fixed it up to come up with this:<br>
<br>
#!/bin/bash<br>
<br>
grep "$1" /etc/passwd | awk -F":" '{ print $3, $4, $5 }' | \<br>
(<br>
while read _UID _GID _COMMENT<br>
do<br>
echo "UID is $_UID, GID is $_GID, and it's $_COMMENT"<br>
done<br>
) <br>
<br>
The ( ... ) construct runs the while loop in a subshell explicitly,
allowing the pipe before it to work. I prepended _ to the variable
names because UID is a read-only shell variable. Now you can save
that to a script and run it as "./script root" and it should come up
with the output for it.<br>
<br>
— Mike<br>
<br>
<div class="moz-signature">-- <br>
<table border="0">
<tbody>
<tr>
<td> <img src="cid:part1.08000504.00090109@naunetcorp.com"
alt="Naunet Corporation Logo"> </td>
<td> Michael B. Trausch<br>
<br>
President, <strong>Naunet Corporation</strong><br>
☎ (678) 287-0693 x130 or (855) NAUNET-1 x130<br>
FAX: (678) 783-7843<br>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>