Freewind
Freewind

Reputation: 198238

What does the `!` before variable in shell mean?

I see in a shell file, it has such code:

getValue ${!value}

You can see there is a ! before the varaible value. I can't find document for this usage, what does it mean?

Upvotes: 1

Views: 575

Answers (1)

iruvar
iruvar

Reputation: 23364

! is used to dereference a variable, see example below:

abc=def
value=abc
echo ${!value}
def

See also Shell Parameter Expansion.

Upvotes: 2

Related Questions