* [gentoo-dev] interesting bit of bash
@ 2003-07-17 2:18 Aron Griffis
0 siblings, 0 replies; only message in thread
From: Aron Griffis @ 2003-07-17 2:18 UTC (permalink / raw
To: gentoo-dev; +Cc: carpaski
I don't know if this would be useful to anybody, but while looking into
a bug, I came up with a method to determine what variables are set by a
file such as make.conf or /etc/conf.d/*
vars_in_file() {
local _file=$1
( eval "`export | sed 's/-/+/'`" # need double-quotes
set -a # export all new vars
. $_file # load up the vars
export | sed -n 's/^declare -x \(.*\)=".*/\1/p' )
}
This function will list the variables set in a file, for example
$ vars_in_file /etc/make.conf
ACCEPT_KEYWORDS
CFLAGS
CHOST
CONFIG_PROTECT_MASK
CXXFLAGS
DISTCC_HOSTS
DISTDIR
FEATURES
GENTOO_MIRRORS
MAKEOPTS
PORTAGE_NICENESS
PORTDIR
USE
$ vars_in_file /etc/conf.d/net
gateway
iface_eth0
The listing should always be correct since the file is being interpreted
(and executed) by bash.
Aron
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-07-17 2:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-17 2:18 [gentoo-dev] interesting bit of bash Aron Griffis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox