bash: variable variables

Friday, December 5th, 2008

How to use variable variables in bash: [mimi:pgl]:~ $ tits=arse [mimi:pgl]:~ $ arse=cheese # this way I figured out myself after a long time pulling my hair out [mimi:pgl]:~ $ echo ${!tits} cheese # this I found later at http://www.seocam.net/how-tos/how-to-create-variable-variables-in-bash [mimi:pgl]:~ $ eval echo $`echo $tits` cheese # how to assign to a variable variable: [vini:plowe]:~ $ tits=cheese [vini:plowe]:~ $ arse=tits [vini:plowe]:~ ...

bash: arrays – assignment, looping, and indexing

Sunday, November 16th, 2008

## arrays in bash: assignment, indexing, and looping ## # assign multiple values to a new array: array=(tits arse) # or: array=([0]=tits [1]=arse) # or: array=([0]=tits arse) # assign single values to specific indices: array[2]='cheese' # add a new value to the end of the array (push) array+=(hmm) # NB: indices do not have to be congiuous: array[5]='last' # view specific element of an ...