`${@:0}' expands to `$0 $1 ...', even though `$0' is not a positional parameter

2021-03-03 Thread Oğuz
The manual says:
>A positional parameter is a parameter denoted by one or more
>digits, other than the single digit 0.

And about `${@:offset:length}', this is what's written there:
>If parameter is @, the result is length positional
>parameters beginning at offset.

Given these statements, I wouldn't expect `$0' to be included in the
expansion of `${@:0}', yet it is.

Wouldn't it be better if it said
> ... beginning at offset, including $0 if offset is zero.
or something like that instead?


-- 
Oğuz


Re: `${@:0}' expands to `$0 $1 ...', even though `$0' is not a positional parameter

2021-03-03 Thread Chet Ramey

On 3/3/21 9:59 AM, Oğuz wrote:

The manual says:

A positional parameter is a parameter denoted by one or more
digits, other than the single digit 0.


And about `${@:offset:length}', this is what's written there:

If parameter is @, the result is length positional
parameters beginning at offset.


"If offset is 0, and the positional parameters are  used,
 $0 is prefixed to the list."


--
``The lyf so short, the craft so long to lerne.'' - Chaucer
 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/



Re: `${@:0}' expands to `$0 $1 ...', even though `$0' is not a positional parameter

2021-03-03 Thread Oğuz
3 Mart 2021 Çarşamba tarihinde Chet Ramey  yazdı:

> On 3/3/21 9:59 AM, Oğuz wrote:
>
>> The manual says:
>>
>>> A positional parameter is a parameter denoted by one or more
>>> digits, other than the single digit 0.
>>>
>>
>> And about `${@:offset:length}', this is what's written there:
>>
>>> If parameter is @, the result is length positional
>>> parameters beginning at offset.
>>>
>>
> "If offset is 0, and the positional parameters are  used,
>  $0 is prefixed to the list."


Yeah, I didn't see it first. Thanks


>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, UTech, CWRUc...@case.eduhttp://tiswww.cwru.edu/~chet/
>


-- 
Oğuz