bug-bash
[Top][All Lists]
Advanced

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

parameter indexing doesn't work for last element


From: Volker Kuhlmann
Subject: parameter indexing doesn't work for last element
Date: Sun, 08 May 2005 12:07:45 +1200
User-agent: KMail/1.7.1

Configuration Information [Automatically generated, do not change]:
Machine: i586
OS: linux
Compiler: gcc -I/usr/src/packages/BUILD/bash-3.0 
-L/usr/src/packages/BUILD/bash-3.0/../readline-5.0
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i586' 
-DCONF_OSTYPE='linux' -DCONF_MACHTYPE='i586-suse-linux' -DCONF_VENDOR='suse' 
-DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  
-I. -I./include -I./lib   -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall 
-D_GNU_SOURCE -Wall -pipe -g -fbranch-probabilities
uname output: Linux ruru 2.6.8-24.14-default #1 Tue Mar 29 09:27:43 UTC 2005 
i686 i686 i386 GNU/Linux
Machine Type: i586-suse-linux

Bash Version: 3.0
Patch Level: 0
Release Status: release

Description:
        Indexing array variables doesn't work for ranges starting not at
        the first element. The manual says:
        
        '${PARAMETER:OFFSET:LENGTH}'
        ... If PARAMETER is an array name indexed by `@' or `*', the
        result is the LENGTH members of the array beginning with
        `${PARAMETER[OFFSET]}'.
        
        With an index of [@], the result is nothing unless OFFSET is the
        last element.
        
        This has worked properly with bash 2, I believe.
        
        I assume I am wasting my time reporting this, but there isn't a
        searchable bug database mentioned on 
        http://directory.fsf.org/GNU/bash.html

Repeat-By:
        showargs() {
        echo "argv (#=$#): ""$@"
        i=0
        while [ $i -le $# ]; do
            echo "argv[$i]:" "'${!i}'"
            i=$(($i + 1))
        done
        }

        updates=( update update/deltas )
        showargs ${updates[@]}
        showargs "${updates[@]:1}"
        echo --
        updates=( update update/deltas word3 )
        showargs ${updates[@]}
        showargs "${updates[@]:1}"
        showargs "${updates[@]:2}"
        
        This produces:
        
        argv (#=2): update update/deltas
        argv[0]: './mkcd/mkmd5'
        argv[1]: 'update'
        argv[2]: 'update/deltas'
        argv (#=0):
        argv[0]: './mkcd/mkmd5'
        --
        argv (#=3): update update/deltas word3
        argv[0]: './mkcd/mkmd5'
        argv[1]: 'update'
        argv[2]: 'update/deltas'
        argv[3]: 'word3'
        argv (#=2): update/deltas word3
        argv[0]: './mkcd/mkmd5'
        argv[1]: 'update/deltas'
        argv[2]: 'word3'
        argv (#=0):
        argv[0]: './mkcd/mkmd5'

-- 
Volker Kuhlmann                 is possibly list0570 with the domain in header
http://volker.dnsalias.net/             Please do not CC list postings to me.





reply via email to

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