[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

[LI] awk and checking of error codes



bilal:/home/bilal $ cat ./test
#!/bin/sh
echo `date` `finger @$1|grep -v $1|grep -v Login|wc -l` $1 \
        | awk '{print $8" ---------- " $7" user(s) present on "$2" "$3" at
"$4}


bilal:/home/bilal $ ./test localhost
localhost ---------- 1 user(s) present on Nov 30 at 16:46:06
bilal:/home/bilal $

When the hostname is not valid etc, it would type Connection Refused and
would print 0 users present --------
I was wondering if I can check error returned before printing out with awk.
I mean if it is possible.

--------------------------------------------------------------------
The Linux India Mailing List Archives are now available.  Please search
the archive at http://lists.linux-india.org/ before posting your question
to avoid repetition and save bandwidth.