On Tue, May 03, 2011 at 09:41:28PM -0500, Jonathan Nieder wrote:
> Rafael Fernandez wrote:
> >         set -- a b c d e f g h i j k l m n o p q r s t u v w x y z
> >         i=1
> >         eval echo '$'$i         # outputs an expected 'a'

I didn't see the original question yet, but it looks like you're trying
to retrieve the Nth positional parameter where N is stored in a variable.
There are two ways to do that in bash, without using eval:

echo "${!i}"

echo "${@:i:1}"

These are bashisms; that is, they do not work in shells that only
implement the POSIX feature set.

Reply via email to