Unix Shell - Re: checking ifconfig success/failure in a Bash script

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > October 2005 > Re: checking ifconfig success/failure in a Bash script





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: checking ifconfig success/failure in a Bash script
markryde@gmail.com

2005-10-26, 6:01 pm

Hello,

The problem is : how to grep from what ifconfig returns ?
I tried:


ifconfig eth0 192.168.0.123 | grep SI
if [ "$?" -eq 0 ] ; then
echo "error"
else
echo "no error"
fi

ifconfig eth0 192.168.0.123 netmask 1.2.3.4 >/dev/null | grep SI
if [ "$?" -eq 0 ] ; then
echo "error"
else
echo "no error"
fi

but in both cases it says "no error"

IN the second there is also :
SIOCSIFNETMASK: Invalid argument

but it seems that my grep does not catch it.
Any idea ?
MR

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com