I'm writing a function that will script the generation of the ifconfig
subdirs. The problem is that I'm trying to expand the value of a
variable where the variable name itself is a variable. EX:
eth0_onboot=yes
eth1_onboot=no
The relevant part of the function is this:
mknet ()
{
net_dir=/etc/sysconfig/network-devices/ifconfig.$1
mkdir $net_dir
echo "ONBOOT=$1_onboot" >$net_dir/$2
<..>
and the function is called as 'mknet <device> <service>' All the
information as to what to put into the fields is pre-defined as exported
variables.
The output of the above echo is "ONBOOT=eth0_onboot" (assuming eth0 was
the device given in the call to mknet).
I can't seem to find a way to expand $1_onboot and then get the value of
the expanded variable name.
Any ideas?
--
Archaic
Want control, education, and security from your operating system?
Hardened Linux From Scratch
http://www.linuxfromscratch.org/hlfs
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page