Nick Zentena <zentena@hophead.dyndns.org> writes:
Okay I'm trying to set my IP into my firewall script automatically. I took the info posted here awhile ago by S.Toms.
EXT_INT="eth0" # whichever you use IPADDR="`ifconfig ${EXT_INT} | grep 'inet addr' | awk '{print $2}' | sed -e 's/.
Which won't work for some reason. I've managed to get:
ifconfig ppp0 | grep 'addr' | awk '{printf $2}' | sed -e s/addr://
to work from the command line but I'm banging my head against the wall getting it to work from within a script. So anybody willing to point out the right way to do this?
Or ... if you prefer to not use perl: export IPADDR=$(ifconfig ${EXT_INT}|sed -ne '/addr:/{s/.*addr:\([^ ]*\).*/\1/;p;}') Hope this (or the perl version) helps. (TIAAWTDI) (Leaving out the export is probably what was causing you problems, but cutting 3 processes down to 1 is always a big savings. -- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/