Linux Today: Linux News On Internet Time.

Tech Tip: Dereference Variable Names Inside Bash Functions

Jan 15, 2010, 21:02 (0 Talkback[s])
(Other stories by Mahaveer Darade)

"We often read (including in the book Advanced Bash-Scripting Guide by Mendel Cooper) that if we pass variable names as parameters to functions, they will be treated as string literals and cannot be dereferenced (ie the value is not available). But this is not so, variable names can be passed as parameters to functions and they can be dereferenced to obtain the value of the variable with the given name.

"The following script demonstrates this:"

Complete Story

Related Stories: