<p>"problem is if I run this command from the server I get<br /> </p>
<pre>Usage: grep [OPTION]... PATTERN [FILE]...<br />Try `grep --help' for more
information." </pre> <p>do a <br /> </p> <pre>if (IS_NUM(ip_addr)){</pre>
<pre>//is client </pre> <pre>}</pre> <pre>else {</pre> <pre>//is
server </pre> <pre>} </pre> <p><br
/>--------------------------------------------------------------------------------<br
/> On 5/2/06, Eric Harrison  wrote: > Thus anything with ".0.0." in it
will match "0.0".<br /> ><br /> ><br /> > This should work
better for you:<br /> ><br /> >         getent hosts | grep ^`echo $DISPLAY |
sed -e 's/:/ /g'\   | awk '{print $1}'` | cut -f1<br /> <br /> Thanks Eric,
interesting and clear explanation. But sitting at the<br /> server this returns
nothing. I need something. 127.0.0.1 works for me.<br /> Explained below.<br /> <br
/> ><br /> ><br /> > BUT, this is all very convoluted. It has the feeling
of approaching a problem<br /> > in the wrong way.  What is the context of what
you are working on? There may<br /> > be a cleaner solution.<br /> <br /> thanks
to you and Jim giving me tips at LinuxFest I was able to speed<br /> up
fl_teachertool amazingly. It's FAST now :)<br /> Using the -n like you suggested<br
/> <br /> netstat -t -e -n | grep :6000 | sed -e 's/:/ /g' | awk '{print $9,$6}'<br
/> | sort | uniq<br /> <br /> works perfect and like lightning compared to having a
dns lookup for<br /> every line of output. So now I have ip's instead of hostnames
of all<br /> clients. This is fine BUT I use the $DISPLAY env variable to omit
the<br /> terminal machine a teacher (running fl_TT) is sitting at (for obvious<br
/> reasons like logging yourself out) So I have to omit the teacher<br /> terminal
by omitting the ip which matches the $DISPLAY.  That's why<br /> 127.0.0.1 works.
Since none of the terminals have this ip none are<br /> omitted (which is what I
want when someone runs fl_TT from the<br /> server).<br /> This line<br /> <br />
cat /etc/hosts | grep `echo $DISPLAY | cut -d: -f1` | cut -f1<br /> <br /> works
when running fl_TT on a terminal but not properly if the teacher<br /> runs fl_TT
on the server (as you noticed)<br /> <br /> Long story short. Basically I just need
fl_teachertool to figure out<br /> the ip of the terminal which it's running on and
if running on the<br /> server it needs to give me an ip which none of the
terminals would<br /> have eg. 192.168.0.254 or 127.0.0.1 so no match to omit is
found. The<br /> only method of determining the ip of the terminals I know of is to
get<br /> the $DISPLAY var and find it's corresponding ip in /etc/hosts (since I<br
/> can't assume ws222.ltsp is 192.168.0.222). If you know an easier way<br /> I'd
love to hear it.<br /> <br /> Hope this is not as clear as mud.<br /> --<br />
Robert Arkiletian<br /> Fl_TeacherTool http://fltk.org/links.php?V269<br /> C++ GUI
tutorial http://fltk.org/links.php?V19<br /> <br />
_______________________________________________<br /> K12OSN mailing list<br />
K12OSN@redhat.com<br /> https://www.redhat.com/mailman/listinfo/k12osn<br /> For
more info see  <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /></p>