Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help returning active interface? 1

Status
Not open for further replies.

rigstars1

Instructor
Oct 2, 2010
19
US
The script searches for active interfaces and returns the correct value except I want to also add a statement in there that returns "No active interfaces found" if there are truly no active interfaces.. having trouble adding an if/else statement in here? Any suggestions?

#!/bin/sh

for iface in `ifconfig -lu` ; do
case $iface in
lo*) continue ;;
esac
ifconfig $iface | grep -q 'inet ' && echo $iface
done
 
[tt]typeset -u WORD
for word in $(<rigstars1post)
do
WORD=$word
case $WORD in
AWK)
break;;
*)
continue;;
esac
done
if [ "$WORD" = "AWK" ]
then
echo "AWK keyword found"
else
echo "AWK keyword not found - WRONG FORUM!"
fi[/tt]

Try forum822 ... ;-)

HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top