bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: let's set the positional parameters with a simple 'read'


From: Greg Wooledge
Subject: Re: let's set the positional parameters with a simple 'read'
Date: Wed, 4 Jan 2012 08:54:06 -0500
User-agent: Mutt/1.4.2.3i

On Wed, Jan 04, 2012 at 02:38:22PM +0800, jidanni@jidanni.org wrote:
> Hmmm, as S. CHAZELAS said seems zsh also gives one a chance to reset an
> arbitrary positional parameter, e.g., the 42nd, whereas in bash one must
> set them all at once:

That is why named arrays are COMPLETELY superior and should be used in
almost every circumstance.

The only reason one would ever use the positional paramters instead of
a named array is because one is writing for sh instead of for bash.

> $ set `seq 55`
> $ echo $42
> 42
> $ echo $66
> 66

That is not doing what you think it is doing.

$ set A B C D E F
$ echo $66
F6

If you want to refer to the 66th positional parameter, you must use ${66}.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]