[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Duration between two time stamps
From: |
Chet Ramey |
Subject: |
Re: Duration between two time stamps |
Date: |
Thu, 19 Aug 2021 10:47:35 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 |
On 8/19/21 1:10 AM, Tapani Tarvainen wrote:
> Incidentally, why does ${var:offset} with a negative offset result in
> an empty string when the variable is shorter than the offset? E.g.,
>
> x=abc
> echo ${x: -6}
>
>
> I find that counterintuitive,
Why? It's an out-of-bounds error.
> and it'd actually be useful to
> be able to get "at most N characters from the end".
If you want that, you can use ${#x} to get the length and work from there.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
- Re: Duration between two time stamps, (continued)
- Re: Duration between two time stamps, Alex fxmbsw7 Ratchev, 2021/08/19
- Duration between two time stamps, hancooper, 2021/08/19
- Re: Duration between two time stamps, Koichi Murase, 2021/08/19
- Duration between two time stamps, hancooper, 2021/08/19
- Re: Duration between two time stamps, Alex fxmbsw7 Ratchev, 2021/08/19
- Re: Duration between two time stamps, Greg Wooledge, 2021/08/19
- Duration between two time stamps, hancooper, 2021/08/19
- Re: Duration between two time stamps, Koichi Murase, 2021/08/19
- Re: Duration between two time stamps, Koichi Murase, 2021/08/19
- Re: Duration between two time stamps, Tapani Tarvainen, 2021/08/20
- Re: Duration between two time stamps,
Chet Ramey <=
- Duration between two time stamps, hancooper, 2021/08/19
- Re: Duration between two time stamps, ikhxcsz7y xmbott, 2021/08/19
- Re: Duration between two time stamps, Emanuele Torre, 2021/08/19
- Re: Duration between two time stamps, Tapani Tarvainen, 2021/08/20
Re: Duration between two time stamps, Chris Elvidge, 2021/08/19
Re: Duration between two time stamps, Alex fxmbsw7 Ratchev, 2021/08/19
Re: Duration between two time stamps, Lee, 2021/08/19