[Leaf-user] Re: porting scripts from ifconfig and awk to iproute and sed

2002-03-25 Thread Charles Steinkuehler
> # get the physical device that leads to the default gateway > netstat -nr | awk '$1 == "0.0.0.0" && $3 == "0.0.0.0" { print $NF }' > # becomes this without netstat or awk > ip route | sed -e '/^default/!d' -e 's/^.* ([^ ]*) $/\1/' This seems OK, although it prints multiple lines if you've got m

Re: [Leaf-user] Re: porting scripts from ifconfig and awk to iproute and sed

2002-03-25 Thread Chad Carr
* Charles Steinkuehler ([EMAIL PROTECTED]) wrote: > Any particular reason you're trying to get rid of ifconfig and awk? Care to > share what you're working on with the class? Please excuse me. Somehow, in a flurry of trying to get up-to-date on emails, I lost this thread almost entirely. What

Re: [Leaf-user] Re: porting scripts from ifconfig and awk to iproute and sed

2002-03-25 Thread Charles Steinkuehler
> Please excuse me. Somehow, in a flurry of trying to get up-to-date on emails, > I lost this thread almost entirely. > > What you said was something like ifconfig, route and netstat should be on any > router, but can't each of those programs be replaced by iproute2? If so, isn't > the interface

Re: [Leaf-user] Re: porting scripts from ifconfig and awk to iproute and sed

2002-03-25 Thread Chad Carr
* Charles Steinkuehler ([EMAIL PROTECTED]) wrote: > Awk is another beast altogether. Awk isn't really required on a LEAF box, > so if you can get the ipsec stuff running without it, that would be pretty > cool. Looks like a lot of work, though. You are right. Too much work, I'm afraid. And si

Re: [Leaf-user] Re: porting scripts from ifconfig and awk to iproute and sed

2002-03-25 Thread Charles Steinkuehler
> I am going to try to do this. I think I am mostly done. Any advice on getting > rid of the "expr" commands that are doing math? See the ash/bash man page. You can do simple math with $(( )) expansion (add, sub, multiply, divide), although numbers are limited in range...ie: echo "2 + 2 = $((

Re: [Leaf-user] Re: porting scripts from ifconfig and awk to iproute and sed

2002-03-26 Thread Chad Carr
* Charles Steinkuehler ([EMAIL PROTECTED]) wrote: > > I am going to try to do this. I think I am mostly done. Any advice on > getting > > rid of the "expr" commands that are doing math? > > See the ash/bash man page. You can do simple math with $(( )) expansion > (add, sub, multiply, divide),