If you have a shell script that sets several variables and you want to
show the value of one of them, you can add
a loop that asks you forvariable names and displays their values : (45.19
while echo "Pick a variable; just RETURN quits: \c"
case "$var" in
"") break ;;
*) eval echo \$$var ;;
The loop prompts
Pick a variable:
, then reads a value;
if you type an empty answer, the loop quits.
Otherwise, the value of that variable is displayed; the
command scans the echo
command line twice.
This tip isn't just good for debugging.
It's good in any shell script where you need to show the value of a variable
by typing its name.