Answers for "bash variable names in commands"

1

bash command in variable

#Just use following structure to store output of command into a variable:
var=$(command)
#For example:
var=$(echo 'hi')	#store hi into var
var=$(ls)	#store list of files into var
Posted by: Guest on December-08-2020
1

bash dynamic variable name

${!var}	#Just use to use reference value inside another variable ;)
Posted by: Guest on December-08-2020
0

bash variable name to function

param=$1
echo ${!param}
Posted by: Guest on October-13-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language