[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Missing character when using ${VAR:1} and length(VAR)==1
From: |
Stephane Chazelas |
Subject: |
Re: Missing character when using ${VAR:1} and length(VAR)==1 |
Date: |
Fri, 21 Sep 2007 07:28:11 +0100 |
User-agent: |
Mutt/1.5.16 (2007-06-11) |
On Fri, Sep 21, 2007 at 05:16:03AM +0200, Jan Schampera wrote:
> Chet Ramey wrote:
>
>>> Description:
>>> there is missing a charachter when using the following:
>>> # TT="oo"; echo "l${TT:1}l"
>>> lol
>>> # TT="o"; echo "l${TT:1}l"
>>> l
>> I can't reproduce this; I get `ll' from the second expansion.
>
> I can't reproduce it on a 2.05b:
> $ TT="o"; echo "l${TT:1}l"
> ll
>
> But I can reproduce it (or at least something weird) on a
> 3.1.17(1)-release:
> $ TT="o"; echo "l${TT:1}l"
> lXl
> (where X is a non-printable character for my terminal here, maybe
> multibyte)
[...]
Same here. The character is DEL:
~$ bash -c 'TT="o"; echo "l${TT:1}l"' | od -c
0000000 l 177 l \n
0000004
~$ locale charmap
ISO-8859-15
~$ bash --version
GNU bash, version 3.1.17(1)-release (i486-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
~/install/bash-3.2$ ./bash -c 'TT="o"; echo "l${TT:1}l"' | od -c
0000000 l l \n
0000003
~/install/bash-3.2$ ./bash --version
GNU bash, version 3.2.25(2)-release (i686-pc-linux-gnu)
Copyright (C) 2005 Free Software Foundation, Inc.
(why doesn't the Copyright extend to 2007, BTW?)
--
Stéphane