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

2018-09-27 Thread L A Walsh
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

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

2018-09-27 Thread L A Walsh
On 9/27/2018 5:42 AM, Dennis Williamson wrote: [include stdalias] #[include Types] #if type-checking include Types+line below lshift () { (($#)) || return 1 int nshift=1 if [[ $1 =~ ^[0-9]+$ ]]; then nshift=$1; shift;fi #if ! isArr $1; then echo >&2 "Need arrayname"; return 1; fi

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

2018-09-27 Thread Greg Wooledge
On Thu, Sep 27, 2018 at 06:47:33PM +0300, Ilkka Virta wrote: > Can you make an array whose name even starts with a digit? No, that's also disallowed. Bash variable names (including arrays) must begin with a letter or underscore.

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

2018-09-27 Thread Ilkka Virta
On 27.9. 15:35, Greg Wooledge wrote: 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

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

2018-09-27 Thread Chet Ramey
On 9/27/18 8:42 AM, Dennis Williamson wrote: > array_shift=2 > arr=("${arr[@]:$array_shift}") > > Done. This is the simplest and most elegant solution. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech,

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

2018-09-27 Thread Dennis Williamson
On Tue, Sep 25, 2018, 7:17 PM 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? > > i.e. > > > set one two three four five > > dcl -a ARGV=("$@") > > shift

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

2018-09-27 Thread Greg Wooledge
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

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

2018-09-25 Thread L A Walsh
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? i.e. set one two three four five dcl -a ARGV=("$@") shift ARGV echo "${ARGV[@]}" two three four five shift 2 ARGV four five