Thread
:
[Linux bash] Why is this not working?
View Single Post
CowboyFromHell
2010-03-11 , 17:55
Posts: 17 | Thanked: 4 times | Joined on Mar 2010 @ Germany
#
19
Forgot to mention: This only works for
my=`/sbin/ifconfig usb0`
otherwise it would be true if *any* network adapter is RUNNING, as all lines are parsed by grep and it would find some line with RUNNING ;°)
So, this complete code must work:
#!/bin/sh
if `/sbin/ifconfig usb0 2>/dev/null | grep -q RUNNING`
then
echo "Ok"
else
echo "Not ok"
fi
if you replace usb0 by $1 as command line argument, you can use it for any network interface.
Last edited by CowboyFromHell; 2010-03-11 at
19:35
. Reason: wrong adapter
Quote & Reply
|
CowboyFromHell
View Public Profile
Send a private message to CowboyFromHell
Find all posts by CowboyFromHell