[TriLUG] possible awk/grep question

Joseph Mack NA3T jmack at wm7d.net
Thu Jan 17 13:50:56 EST 2008


On Sun, 30 Dec 2007, David Black wrote:

> If a user means their default group is 100 - for fun, here's a variation
> using bash alone:
>
> #!/bin/bash
> IFS=':\n'
> (while read USR F2 F3 GID F5; do
>        if [ $GID -eq 100 ]; then
>                echo $USR
>        fi
> done) < /etc/passwd

I'm trying this but the passwd file is on another machine, 
the contents of which I get by

ssh $machine cat /etc/passwd

I can do

ssh $machine cat /etc/passwd > foo
while
do
.
.
done) <foo

but I'd rather not write anything to an intermediary file.

In my first attempt, the "done" line becomes

done) < `ssh $machine cat /etc/passwd`

when I get the error "ambiguous redirect".

It's been ages since I've seen that message and google isn't 
any help. I can't figure out how to make the output of

ssh $machine cat /etc/passwd

look like a file.

Any suggestions?

Thanks Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!



More information about the TriLUG mailing list