[ale] read config file from shell script

Randy Janinda randy.janinda at ndcorp.com
Wed Dec 1 07:56:34 EST 1999


On  0, Nick Lucent <nlucent at mindspring.com> wrote:
> Im writing a set of scripts to automatically a: determine my IP (dhcp), then
> update /etc/hosts accordingly (change IP and domain), and b: perform other
> scripted functions depending on that IP (change netscapes proxy etc). My
> question is, how do I read a config file in the format of
> HOME=192.168.1
> WORK=15.23.126
> etc. Would I use sed or awk? Right now its hardcoded into the script, but
> that isnt a very good approach. Also how do I replace an entire line in
> /etc/hosts? Would I use sed or awk for that as well?
> 
> Thanks
> Nick
> 
> ps. If any of this isnt very clear please let me know and Ill allaborate
> more =)
> 
> -- 
Just a quickie:
	You can get your dynamically assigned IP right from your "ip-up" script.
It is the variable: $4. With that said you can add this line to your "ip-up" 
script and have it stick the IP in the config files or whatever:
	cat /config/file | sed s/--IP--/$4/g


-- 
Randy Janinda

############################################
HTTP://www.tqlabs.com - Online port database
############################################






More information about the Ale mailing list