Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jan 2005 15:30:58 -0500
From:      Timothy Luoma <lists@tntluoma.com>
To:        Eric F Crist <ecrist@secure-computing.net>
Cc:        FreeBSD-Questions Questions <freebsd-questions@freebsd.org>
Subject:   Re: my lame attempt at a shell script...
Message-ID:  <6074EB8D-5DC6-11D9-89A5-000D93AD26C8@tntluoma.com>
In-Reply-To: <15416223037.20050103193803@hexren.net>
References:  <06DDB71C-5DB4-11D9-B56F-000D9333E43C@secure-computing.net> <15416223037.20050103193803@hexren.net>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jan 3, 2005, at 1:38 PM, Hexren wrote:

> I am not that great at bash but look in /etc/rc.firewall for the line
> where it says: ". /etc/defaults/rc.conf" I think this line includes
> /etc/rc.conf into the running script and as code in rc.conf is
> evaluated at the time it is included, all the variables defined in
> rc.conf are created at that time in your script. (you do realize that
> for example gateway_enable="YES" is an variable declaration with
> initialization when read as shell script ?)

Hexren is right, ". /some/file" does mean "include /some/file" 
(sometimes called "source")

#!/bin/sh

. /etc/rc.conf

if [ "$gateway_enable" = "YES" ]
then
         echo "yes, this machine is a gateway"
else
         echo "no, this is not a gateway"
fi

exit 0

TjL



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6074EB8D-5DC6-11D9-89A5-000D93AD26C8>