7

get a variable's content, from the contents of another variable, both variable names have the same trailing number

view full story
linux-howto

http://stackoverflow.com – in a bash script, How do I get a variable's content, from the contents of another variable, both variable names have the same trailing number? IP1=192.168.0.17 DIR1=/mnt/2tb/archive/src/ IP2=192.168.0.11 DIR2=~/src/ IP3=192.168.0.113 DIR3=~/src/ #get local ip and set variable HOST to local ip HOST=$(ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}') # get HOST source DIR as variable from ip and preset variables echo $HOSTDIR (HowTos)