bug-bash
[Top][All Lists]
Advanced

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

Substring Expansion.


From: Luc Teirlinck
Subject: Substring Expansion.
Date: Mon, 30 Dec 2002 22:34:16 -0600 (CST)

I checked the Bug-bash archives and as I suspected, you did not
receive my bug reports.  I send copies.


Subject: [50 character or so descriptive subject here (for reference)]
Substring Expansion.
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' 
-DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H  -D_GNU_SOURCE 
-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

Description:
        [Detailed description of the problem, suggestion, or complaint.]
Should the line marked with ### in the bash run below not be:
7 8 9
as it is in the string version?
As a secondary suggestion, it would be nice if ${a:-3} and address@hidden:-3}
would work as expected, although the fact that they do not is not a bug.
(I understand that strictly speaking -3 is a string, not an integer, in
as far as bash is concerned.)
The bug (if it is one) occurs in both bash2.05.8 and bash2.05b.0.

Repeat-By:
        [Describe the sequence of events that causes the problem
        to occur.]
[bash2.05b.0 ~ 3 1] a=0123456789
[bash2.05b.0 ~ 3 2] echo ${a:$((-3))}
789
[bash2.05b.0 ~ 3 3] b=( 0 1 2 3 4 5 6 7 8 9 )
[bash2.05b.0 ~ 3 4] echo address@hidden:$((-3))}
8 9     ###
[bash2.05b.0 ~ 3 5] echo ${a:-3}
0123456789
[bash2.05b.0 ~ 3 6] echo address@hidden:-3}
0 1 2 3 4 5 6 7 8 9
[bash2.05b.0 ~ 3 7] 



reply via email to

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