Shell scripting question



I'm thinking about writing an rc.subr script that sucks in variables from a conf file. Since the rc.firewall script does just that, I thought I'd take a look at it. But I can't understand what it's doing.

Here's the code:

# Suck in the configuration variables.
if [ -z "${source_rc_confs_defined}" ]; then
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
fi

Neither rc.conf nor source_rc_confs appears anywhere else in the script, so how does this suck in the variables? And what does the syntax ". /etc/rc.conf" do?

Here's what I understand so far. If the variable source_rc_confs_defined is a zero length string, then if /etc/defaults/rc.conf is readable, then do something with it. I have no idea what the next line "source_rc_confs" does. Else, if /etc/rc.conf is readable, then do something with that.

Can someone explain what all this does please?

Paul Schmehl (pauls@xxxxxxxxxxxx)
Adjunct Information Security Officer
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/

Relevant Pages

  • Re: More Bloody Cheek
    ... In message, Richard Robinson writes ... time for their purposes according to all these "suck people people into ... script, there's a script. ...
    (uk.rec.sheds)
  • Re: Quick sed question -- thanks
    ... I suck so much at it. ... Basically I am in need of a sed statement by ... I am using ksh. ... running your script with zsh in ksh emulation mode. ...
    (comp.unix.shell)
  • Re: More Bloody Cheek
    ... Peter Thomas said: ... time for their purposes according to all these "suck people people into ... Just say something that isn't in the script. ...
    (uk.rec.sheds)
  • Re: Shell scripting question
    ... On Mar 24, 2006, at 12:12 PM, Paul Schmehl wrote: ... script, so how does this suck in the variables? ... And what does the syntax ". ...
    (freebsd-questions)
  • Re: [WR] round tuits
    ... Jackson Pillock wrote: ... I do, too many projects going, not enough time, priorities lean toward ... I started writing a precinct drama set in a locked psychiatric ward. ... Sent off my script. ...
    (misc.writing)