Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Feature request: ${(l[-3][0])var} to do left padding *without truncation*



2024-08-03 21:31:52 +0100, Stephane Chazelas:
[...]
> but get_intarg has:
> 
>     if (ret < 0)
>         ret = -ret;
[...]

For the record, other usages of get_intarg are in ${(I[3])var/x/y} to replace
the 3rd occurrence, with again an ineffective:

                case 'I':
                    s++;
                    flnum = get_intarg(&s, &dellen);
                    if (flnum < 0)
                        goto flagerr;
                    s--;
                    break;

Here a negative value could be useful to replace the 3rd last occurrence.

And in $var:F[3]s/X/Y/ to repeat the substitution 3 times. This time no check
for negative values.

-- 
Stephane




Messages sorted by: Reverse Date, Date, Thread, Author