Re: how to do doube substitution
- From: "Stachu 'Dozzie' K." <dozzie@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 23 Dec 2005 02:32:35 +0000 (UTC)
On 23.12.2005, vik.reck@xxxxxxxxx <vik.reck@xxxxxxxxx> wrote:
> #!/bin/bash
> ABCD_dir=kernel
> module=ABCD
>
> # I want to echo "kernel" here. How can i do it?
> echo \"$"$module"_dir\"
bash, huh? Try this:
#v+
module_temp=${module}_dir
echo "${!module_temp}"
#v-
Or more portable (and preferred, at least by me):
#v+
ABCD_dir=kernel
module=ABCD
eval "echo \"\$${module}_dir\""
#v-
--
Feel free to correct my English
Stanislaw Klekot
.
- References:
- how to do doube substitution
- From: vik.reck@xxxxxxxxx
- how to do doube substitution
- Prev by Date: how to do doube substitution
- Next by Date: Re: get the first word of a file
- Previous by thread: how to do doube substitution
- Index(es):
Relevant Pages
|