Answer the question
In order to leave comments, you need to log in
How to organize the output of a variable declared earlier?
Probably a stupid question, but somehow I have never come across this before and I don’t understand how to formulate it.
Let's say we have some variables, let's say environment variables:
VAR_NAME[0-9]=VAL
We want to make a function to display the name of the variable and its value:
print_var_val(){
echo "$1=$($1)" # ?? Чем заменить эту конструкцию $($1) ??
}
Answer the question
In order to leave comments, you need to log in
https://www.gnu.org/savannah-checkouts/gnu/bash/ma...
print_var_val() {
echo "$1=${!1}"
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question