Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14675
| Path | csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail |
|---|---|
| From | L A Walsh <bash@tlinx.org> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: comment on RFE: 'shift'' [N] ARRAYNAME |
| Date | Thu, 27 Sep 2018 10:56:45 -0700 |
| Lines | 39 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1411.1538071020.1284.bug-bash@gnu.org> (permalink) |
| References | <5BAAD017.4010806@tlinx.org> <20180927123551.j5attjixprhoxavx@eeg.ccf.org> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | usenet.stanford.edu 1538071021 11931 208.118.235.17 (27 Sep 2018 17:57:01 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| User-Agent | Thunderbird |
| In-Reply-To | <20180927123551.j5attjixprhoxavx@eeg.ccf.org> |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] |
| X-Received-From | 173.164.175.65 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:14675 |
Show key headers only | View raw
On 9/27/2018 5:35 AM, Greg Wooledge wrote:
> 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.
>
---
Why do you think I was blindly copying perl. My function example
was/is named lshift to differentiate it from rshift (if wanted),
but if it was a builtin there'd be no need for a different
name as it works and has compatible syntax with current 'shift'.
shift [N] ARRAYNAME. Without ARRAYNAME, it's is the 'shift [N]' that
is already in bash. There is no quagmire. If the parameter following
'shift'
is a number, it's a count. If it isn't a number, its an ID. Even
though my example and the subject showed the 'count' first, the order
really doesn't matter if you think about it...
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: comment on RFE: 'shift'' [N] ARRAYNAME L A Walsh <bash@tlinx.org> - 2018-09-27 10:56 -0700
csiph-web