[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bash substrings: wish for support for negative length (read till n f
From: |
Jan Schampera |
Subject: |
Re: Bash substrings: wish for support for negative length (read till n from end) |
Date: |
Tue, 08 Jul 2008 06:33:22 +0200 |
User-agent: |
IceDove 1.5.0.14eol (X11/20080509) |
Jan Schampera wrote:
> Richard Neill wrote:
>
>> $ echo ${stringZ:2: -1} #Wish: start at 2, read till
>> ERROR #1 before the end. i.e.
>> # cde
>>
>> $ echo ${stringZ: -3: -1} #Wish: start 3 back, read till
>> ERROR #1 before the end. i.e.
>
> Use (-1), i.e.
>
> $ echo ${stringZ:2:(-1)}
>
> See also
> http://bash-hackers.org/wiki/doku.php/syntax/pe#substring_expansion (at
> bottom of the section).
>
> J.
My bad - it's too early in the morning - forget about that :)
I didn't read carefully.
J.