[Top][All Lists]

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

Negative indexes in address@hidden:off:length}

From: lhunath
Subject: Negative indexes in address@hidden:off:length}
Date: Sat, 25 Jun 2011 17:35:24 +0200 (CEST)

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: darwin10.7.1
Compiler: /usr/bin/gcc-4.2
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='darwin10.7.1' -DCONF_MACHTYPE='i386-apple-darwin10.7.1' 
-DCONF_VENDOR='apple' -DLOCALEDIR='/opt/local/share/locale' -DPACKAGE='bash' 
-DSHELL -DHAVE_CONFIG_H -DMACOSX   -I.  -I. -I./include -I./lib  
-I/opt/local/include -pipe -O2 -arch x86_64
uname output: Darwin Myst 10.7.4 Darwin Kernel Version 10.7.4: Mon Apr 18 
21:24:17 PDT 2011; root:xnu-1504.14.12~3/RELEASE_X86_64 x86_64
Machine Type: i386-apple-darwin10.7.1

Bash Version: 4.2
Patch Level: 8
Release Status: release

        Bash now allows us to use negative array indexes to address array 
elements relative to the end of the array:
    arr=(a b c); echo "${arr[-1]}"

    In line with that, I'd like to propose extending that functionality to 
other operations that address array elements:
    echo "address@hidden:0:-1}" # Expected: c
    echo "address@hidden:1:-2}" # Expected: a c

reply via email to

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