views:

62

answers:

1

Nested variables have prevented me from trying to use BASH more extensively... consider the following:

export SYS_DIR='/home/${LOGNAME}/sys'
export APP_DIR='${SYS_DIR}/app'

I always end up with

> set
APP_DIR=/home/${LOGNAME}/sys/app

why? lol

and how do I get what I want =/

I'm not trying to resolve ${${var}}, but rather actual strings as shown above

+7  A: 

Use double quotes

export APP_DIR="${SYS_DIR}/app"

Single quotes treat everything inside as literal, not evaluated.

Stephen
Additionally, consider looking into "Advanced Bash Guide" via Google for all things bash ;)
Victor Sorokin