Alright, this is fairly geeky, but I’d like to know if there is a better way of doing this.
Something I love about perl is how many places it lets you interpolate. Being used to this flexibility, I wanted to do something similar in a shell script (in particular, my .bash_profile
). This is my first stab at it:
To interpolate shell variables into a new variable:
abc=`eval echo \\$$a$b$c`
As a side, BASH allows you to do single variable interpolation by: ${!var}
.
Please let me know if there is a better way!