Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Mar 2006 11:12:06 -0600
From:      Paul Schmehl <pauls@utdallas.edu>
To:        FreeBSD-questions@FreeBSD.org
Subject:   Shell scripting question
Message-ID:  <5045F0637A62EE469942AAB4@utd59514.utdallas.edu>

next in thread | raw e-mail | index | archive | help
--==========15387BF1021E1D67A09F==========
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

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 ".=20
/etc/rc.conf" do?

Here's what I understand so far.  If the variable source_rc_confs_defined=20
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"=20
does.  Else, if /etc/rc.conf is readable, then do something with that.

Can someone explain what all this does please?

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5045F0637A62EE469942AAB4>