bug-bash
[Top][All Lists]
Advanced

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

Sub-arrays do not work with non-blank IFS


From: Lea Wiemann
Subject: Sub-arrays do not work with non-blank IFS
Date: Mon, 07 Jan 2008 04:44:44 +0100
User-agent: Thunderbird 2.0.0.9 (X11/20071031)

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:

If the IFS does not contain a blank, copying an array using
("${array[@]}") works, but creating a sub-array using
("${array[@]:offset:length}") does not work.

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]