Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14669 > unrolled thread

Re: comment on RFE: 'shift'' [N] ARRAYNAME

Started byGreg Wooledge <wooledg@eeg.ccf.org>
First post2018-09-27 08:35 -0400
Last post2018-09-27 08:35 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: comment on RFE: 'shift'' [N] ARRAYNAME Greg Wooledge <wooledg@eeg.ccf.org> - 2018-09-27 08:35 -0400

#14669 — Re: comment on RFE: 'shift'' [N] ARRAYNAME

FromGreg Wooledge <wooledg@eeg.ccf.org>
Date2018-09-27 08:35 -0400
SubjectRe: comment on RFE: 'shift'' [N] ARRAYNAME
Message-ID<mailman.1385.1538051793.1284.bug-bash@gnu.org>
On Tue, Sep 25, 2018 at 05:17:27PM -0700, L A Walsh wrote:
> It struck me as it might be convenient if 'shift' could take an optional
> arrayname as an argument.  Would that be possible or would it cause some
> incompatibility?

The biggest issue here is how you specify the arguments.

Shift already takes one optional argument: the number of items to shift
from the argv list.  Adding a second optional argument leads to a quagmire.
Do you put the optional list name first, or do you put the optional number
first?  If only one argument is given, is it a list name, or is it a number?

(OK, granted, in bash it is not permitted to create an array whose name
is strictly digits, but still.)

If you wish to write an array-shifting builtin, it would be better to give
it a new name.  Don't blindly copy perl.  It's not always the best example
of language design.

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web