Tech Tip: Dereference Variable Names Inside Bash Functions
Jan 15, 2010, 21:02 (0 Talkback[s])
(Other stories by Mahaveer Darade)
WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
"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:"