In message <[EMAIL PROTECTED]>, Tim Kientzle cleopede: >Terry Lambert wrote: > >> Tim Kientzle wrote: >>>I'm trying to figure out how to read and use >>>/etc/rc.conf configuration variables from within >>>a C program. >> >> #!/bin/sh >> # Throw all of rc.conf into the environemnet so a C program >> # named "fred" can read any of them with "getenv". >> . /etc/rc.conf >> fred > > >This doesn't work. /etc/rc.conf does not export >its variables to the environment. It only sets them in the >local shell. Try the above where 'fred' is > #!/bin/sh > printenv >and you'll see what I mean.
Try using the "set -a" command before reading rc.conf and it will work: #!/bin/sh set -a . /etc/rc.conf exec yourprog Greg Shenaut To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-hackers" in the body of the message