cat myscript#!/bin/sh ... while echo "Pick a variable; just RETURN quits: \c" read var do case "$var" in "") break ;; *) eval echo \$$var ;; esac done
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.