What does the "!" in "${!VARIABLE:-\n}" mean?

so I'm going over this script someone else wrote and I haven't seen the aforementioned construct before.

The code says:

declare VAR1="${!VARIABLE:-\n}"

I know what the ":-\n" does but I don't understand why would one negate ("!") the variable in the first place. Am I reading this right that even if VARIABLE is set, always fall back to the default (:-\n)?

PS: "VARIABLE" is defined at the beginning of the script as "VARIABLE=test"

1 Like

man bash :

2 Likes

Thank you, I read up on "variable indirection" and it now makes sense.

1 Like