Skip to content

Instantly share code, notes, and snippets.

@leohacker
Created June 12, 2016 05:51
Show Gist options
  • Save leohacker/e701ff3d00c0e52035bbed96d86af1f7 to your computer and use it in GitHub Desktop.
Save leohacker/e701ff3d00c0e52035bbed96d86af1f7 to your computer and use it in GitHub Desktop.
Indirect reference in bash ( check a variable if its value as variable is set )
# varname=USER or PROFILE_PATH
# $varname == USER
# $$ pid of current process
# \$$varname == $USER in literal
# eval variable=..... evaluate and assign to variable
eval variable=\$$varname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment