in reply to Extracting network information
Simply escaping the dollars in the awk command will do the trick:
chomp($sysip = `ifconfig | grep -i inet | egrep -v "inet6|127.0.0.1" | head -n 1 | awk '{print \$2}'`);However, I won't be the only one here who recoils at the way this script is constructed. When you have time, it would be a very good idea to rewrite this in a more efficient and robust manner (as an exercise if nothing else).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Extracting network information
by Kasemodder (Initiate) on Sep 01, 2015 at 18:34 UTC |