Shell scripting question
Paul Schmehl
pauls at utdallas.edu
Fri Mar 24 17:12:29 UTC 2006
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 at utdallas.edu)
Adjunct Information Security Officer
The University of Texas at Dallas
http://www.utdallas.edu/ir/security/
More information about the freebsd-questions
mailing list