[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bash 3 breaks array expansion
From: |
Roy Marples |
Subject: |
Bash 3 breaks array expansion |
Date: |
Thu, 12 Aug 2004 17:26:06 +0100 |
Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' -$uname
output: Linux uberlaptop 2.6.7 #2 Sun Jul 18 12:00:59 BST 2004 i686
Mobile Intel(R) Celeron(R) CPU 1.60GHz GenuineInte$Machine Type:
i686-pc-linux-gnu
Bash Version: 3.0
Patch Level: 0
Release Status: release
Description:
Bash 3 breaks array expansion
Repeat-By:
#!/bin/bash
x=(one two)
echo ${x[@]:1}
# prints nothing in bash 3
# prints two in bash 2
x=(one two three)
echo ${x[@]:1}
# prints two three as expected in bash 2
Fix:
(really a work around)
#!/bin/bash
x=(one two)
x=("${x[@]}" "xxx")
echo ${x[@]:1:${#x[@]} - 2}
- Bash 3 breaks array expansion,
Roy Marples <=