[KLUG Members] bash builtin substr function

Ron Sweeney ron.sweeney at gmail.com
Thu May 5 15:29:01 EDT 2005


any help here would be hot... I need to enumerate an ip address
through a bash script without the use of anything but the shell
itself...  the shell is an embedded shell and extremely limited in
what is available...

no perl
no cut
no awk

Here is what I have so far...

#!/bin/bash

IPADDR=`ifconfig -a eth0 | grep "inet addr"`

echo ${IPADDR#"inet addr:"*" "}

this still prints out the line... the output I need is the IPADDR only
of the specified network interface...

Thanks again...



More information about the Members mailing list