On Tue, Mar 18, 2003 at 05:12:35PM +0000, Jon Reades wrote: > > Mongers, Mongchop to you ;-) > > I've been trying to assemble a simple bash script that will set up some > simple VPN tunnels for me when I need to connect to my company's > Netscreen box. > > I've made it most of the way there, but I currently need one script for > each possible address (e.g. sh /init.d/vpn/192.168.0.1.sh, sh > /init.d/vpn/192.168.1.1.sh). > > A much easier way to do this would be to have the bash script get the > local IP address by requesting it directly from the client machine. > Unfortunately, ifconfig is a little hard to parse if you're not human > and using bash, and I can't find any other functions to return just the > IP address of, say, en0. > /sbin/ifconfig|grep eth0 -2|grep inet|cut -f2 -d:|awk '{print $1}' would work, non? for eth0 anyway. that extends fairly trivially to something for each eth stanza...
why not just use perl? :-p /joel