Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following lines in my .cfg bash script file


how is ${!DDF_SOURCE} evaluated? It would be !siebel_DATA_DATE_FORMAT, which doesn't make sense to me.

share|improve this question
up vote 24 down vote accepted

That is an indirect expansion, documented in man bash section EXPANSION, subsection Parameter Expansion:

If the first character of parameter is an exclamation point (!), a level of variable indirection is introduced. Bash uses the value of the variable formed from the rest of parameter as the name of the variable; this variable is then expanded and that value is used in the rest of the substitution, rather than the value of parameter itself. This is known as indirect expansion.

bash-4.2$ DDF_SOURCE="siebel_DATA_DATE_FORMAT"

bash-4.2$ siebel_DATA_DATE_FORMAT='Hello Indirect Redirection'

bash-4.2$ DATA_DATE_FORMAT=${!DDF_SOURCE} # siebel_DATA_DATE_FORMAT must get value before this line

bash-4.2$ echo $DATA_DATE_FORMAT
Hello Indirect Redirection
share|improve this answer
+1 for both excerpt from man page and very clear example – Levon Jun 21 '12 at 16:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.