bug-bash
[Top][All Lists]
Advanced

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

${array[@]:offset:length} problem with non-blank IFS


From: Lea Wiemann
Subject: ${array[@]:offset:length} problem with non-blank IFS
Date: Mon, 07 Jan 2008 03:02:05 +0100

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
-DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib   -g -O2
uname output: Linux fly 2.6.22-3-686 #1 SMP Mon Nov 12 08:32:57 UTC 2007 i686 
GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 3.1
Patch Level: 17
Release Status: release

Description:

When IFS does not contain the blank character, var="(${array[@]})"
works fine, but var="(${array[@]:offset:length})" does not (it creates
a single-element array).

Repeat-By:

IFS=$'\n'
a=(A B C D)
b=("${a[@]}")
echo "${#b[@]}", "${b[@]}"  # 4, A B C D -- OK
b=("${a[@]:2}")
echo "${#b[@]}", "${b[@]}"  # 1, C D -- bug, should be 2, C D




reply via email to

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