sh script to what's presented in the question:
eval "echo \"\$$var\"" # or: eval 'echo "$'"$var"'"'
eval line will evaluate the given string as a command in the current environment. The given string is
echo \"\$$var\", which, after variables have been expanded etc., would become
echo "$exe1". This is passed to
eval for re-evaluation, and the command prints the string
You also mention arrays. It is true that the POSIX
sh shell does not have named arrays in the same sense that e.g.
bash has, but it still has the list of positional parameters.
With it, you can do most things that you'd need to do with a list in the shell.
set -- 'filepath1' 'filepath2' 'filepath3'
for name in "$@"; do # or: for name do
which is the same as just
for name in 'filepath1' 'filepath2' 'filepath3'
Since I'm usure of what it is you're trying to achieve, I can't come up with a more interesting example. But here you have an array-like structure that you iterate over. Why you'd want to iterate over names of variables is still not clear.