[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: eval
From: |
Greg Wooledge |
Subject: |
Re: eval |
Date: |
Wed, 4 May 2011 08:19:22 -0400 |
User-agent: |
Mutt/1.4.2.3i |
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.
- Re: eval, (continued)
- Re: eval, Jonathan Nieder, 2011/05/04
- Re: eval, Andreas Schwab, 2011/05/04
- Re: eval, Rafael Fernandez, 2011/05/05
- Re: eval, Chet Ramey, 2011/05/05
- Re: eval, Eric Blake, 2011/05/05
- Re: eval, Chet Ramey, 2011/05/05
- Re: eval, Eric Blake, 2011/05/05
- Re: eval, Chet Ramey, 2011/05/05
- Re: eval, Sven Mascheck, 2011/05/05
- Re: eval, Chet Ramey, 2011/05/05
Re: eval,
Greg Wooledge <=