Newbie: freebsd admin scripting

Muffin Muffin at BottomPost.Trim
Tue Jul 17 12:01:11 EDT 2007


I am using python for the first time on Unix and on FBSD. I need a few 
pointer, tips or tricks on scripting on config files. Mostly admin type 
configs like the rc.conf file usually setup like:

someiteam=somevalue        #sometype of description

Where I would like to toggle the somevalue in an easy way. I realize I 
could parse it with reg expression but that sounds kinda complicated. Is 
there an easer way a Unix python way of dealing with these type of 
config files.

I found a built in mod for parseconfig but it deal with .ini file styles 
(windows) that include a [section] header as well as uses 
someiteam=somevalue format. I believe it requires the header though.

Books or howtos regarding Unix admin scripting(python) would be great. 
Is this type of scripting mainly executing a Unix command and capturing 
and parsing its output like this:

x=command.getoutput("ifconfig")

and them parsing x for what I want or is there a name space I can call 
to get , for example, a list of all interfaces?

I have mainly used python in windows using the com space or win32 api 
aside from the base python lib, on Unix I am lost on what to do or how 
things are generally done. Advise on how to "think" in Unix python terms 
if that makes any sense.

Thx



More information about the Python-list mailing list