[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Unintended(?) change in behavior of ${#a}.

From: Luc Teirlinck
Subject: Unintended(?) change in behavior of ${#a}.
Date: Wed, 1 Jan 2003 18:34:05 -0600 (CST)

Subject: [50 character or so descriptive subject here (for reference)]
Unintended(?) change in behavior of ${#a}. 
Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' 
-D_FILE_OFFSET_BITS=64  -I.  -I. -I./include -I./lib -I/usr/include -O2 
-march=i386 -mcpu=i686
uname output: Linux swt40.swt.com 2.4.9-7smp #1 SMP Thu Oct 18 13:34:30 EDT 
2001 i686 unknown
Machine Type: i386-redhat-linux-gnu

Bash Version: 2.05
Patch Level: 8
Release Status: release

        [Detailed description of the problem, suggestion, or complaint.]
The behavior of ${#a} has changed between 2.05.8 and 2.05b.0, as the
included bash sessions show.  In 2.05.8 ${#a} expanded to the full
length of `a', including all whitespace, as suggested by the
documentation.  In 2.05b.0, leading whitespace is not counted, although
trailing whitespace is.  I believe that this is an unintentional bug.
If it is intentional, the documentation should be adapted to reflect
the new behavior.

        [Describe the sequence of events that causes the problem
        to occur.]
[bash2.05b.0 ~ 3 1] echo $BASH_VERSION  
[bash2.05b.0 ~ 3 2] export a="           b  "
[bash2.05b.0 ~ 3 3] echo ${#a}
[bash2.05b.0 ~ 3 4] /bin/bash
[bash2.05.8 ~ 4 1] echo $BASH_VERSION
[bash2.05.8 ~ 4 2] echo ${#a}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]