Jason S. on Mon, 20 Sep 1999 10:00:05 -0400 (EDT) |
You want the commands to execute. Replace the single quotes with backtics: loceth0=`/sbin/ifconfig | grep -A 4 eth0 | awk ' /inet/ { print $2 } ' sed -e s/addr:// ` Or this: LOCALIF=eth0 LOCALIP=`ifconfig $LOCALIF | grep inet | cut -d : -f 2 | cut -d \ -f 1` J. When I grow up, I wanna be more like me. I had a clue. I didn't like it. I took it back and exchanged it for an attitude. On Sat, 18 Sep 1999, George McNeal wrote: > I want to write a script that parses the local eth0 IP address out of > /sbin/ifconfig and assigns the value to a variable (loceth0) and later > use $loceth0 as a value. The following executed on a command line gives > the correct IP.: > > /sbin/ifconfig | grep -A 4 eth0 | awk ' /inet/ { print $2 } ' | sed -e > s/addr:// > > However, if I write > > loceth0='/sbin/ifconfig | grep -A 4 eth0 | awk ' /inet/ { print $2 } ' > sed -e s/addr:// ' > > I get errors. I am using the Bash shell. What is the correct syntact > or is there another route? > _______________________________________________ Plug maillist - Plug@lists.nothinbut.net http://lists.nothinbut.net/mail/listinfo/plug
|
|