> +             if [ "$usage" = "dhcp" ]; then
> +                     NET_CONFIG=dhcp
> +             else
> +                     NET_CONFIG=static
> +                     IP_ADDRESS=$(cat "$netinfo" | grep "^my_ipaddress" | 
> sed 's/.*=//')
> +                     NETMASK=$(cat "$netinfo" | grep "^my_subnetmask" | sed 
> 's/.*=//')
> +                     GATEWAY=$(cat "$netinfo" | grep "^my_dgw" | sed 
> 's/.*=//')
> +             fi
> +     fi
> +     hostinfo=$path/rootfs/etc/host.info
> +     if [ -e "$hostinfo" ]; then
> +             HOSTNAME=$(cat "$hostinfo" | grep "^hostname" | sed 's/.*=//')
> +     fi


   cat "$infofile" | grep "^string" | sed 's/.*=//'

can be rewritten as

   grep "^string" "$infofile" | sed 's/.*=//'


with the advantage of 'cat' not being spawned.



Further rewrite to

   sed -n '/^string/s/.*=//' "$infofile" 

even avoids 'grep' being started.



Cheers
Geert Stappers


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to