The next three days is CodeCon. This year I’m officially on staff handling the CodeCon Live Audio streams. You can view the schedule to see what topic is at hand.
Archive for the ‘geek’ Category
CodeCon 2005
Friday, February 11th, 2005Shell variable interpolation
Friday, August 20th, 2004Alright, 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!