var1=0
var=$var1
(Some conditions that may change $var1)
var1=1
echo $var
I need to have 1 as output of echo $var. In other words, I need to get a new value if the variable1 contained in variable if it change.
Are there some special options or quotes that will allow me to do that?
EDIT:
FILE=ArchLinuxARM-$DATE-$TARGET.img
DATE=2015.10
TARGET=rpi-2
echo ${!FILE}
Will echo nothing. (It should echo ArchLinuxARM-2015.10-rpi-2.img)
For your specific question, you'd be better served with a function:
filename() { echo "ArchLinuxARM-$DATE-$TARGET.img"; }
DATE=2015.10
TARGET=rpi-2
echo "$(filename)"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With