From: Aron Griffis <agriffis@gentoo.org>
To: gentoo-dev@gentoo.org
Cc: carpaski@gentoo.org
Subject: [gentoo-dev] interesting bit of bash
Date: Wed, 16 Jul 2003 22:18:08 -0400 [thread overview]
Message-ID: <20030717021807.GA17747@time> (raw)
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
reply other threads:[~2003-07-17 2:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030717021807.GA17747@time \
--to=agriffis@gentoo.org \
--cc=carpaski@gentoo.org \
--cc=gentoo-dev@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox