bug-bash
[Top][All Lists]
Advanced

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

quoted and concatenated positional parameters


From: gregrwm
Subject: quoted and concatenated positional parameters
Date: Wed, 23 May 2012 21:47:33 -0500

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-redhat-linux-gnu'
-DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I. -I./include
-I./lib  -D_GNU_SOURCE -DRECYCLES_PIDS  -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m64 -mtune=generic -fwrapv
uname output: Linux okra.fo4.net 2.6.32-042stab053.5 #1 SMP Tue Mar 27
11:42:17 MSD 2012 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-redhat-linux-gnu

Bash Version: 4.1
Patch Level: 2
Release Status: release

Description:
        expansion anomaly with quoted and concatenated positional parameters

Repeat-By:
a(){ echo
     echo '"${@:2}a3 a2" a$1    #works as long as $1 and 3 are swapped'
     echo  "${@:2}a3 a2" a$1
           "${@:2}a3 a2" a$1
     echo   $?
        a=("address@hidden");}
b(){ echo
     echo '"${@:2}b$1 b2" b3    #fails!  why?'
     echo  "${@:2}b$1 b2" b3
           "${@:2}b$1 b2" b3
     echo   $?
        b=("address@hidden");}
c(){ echo
     echo  '${@:2}c$1 c2 c3     #works as long as quoting omitted'
     echo   ${@:2}c$1 c2 c3
            ${@:2}c$1 c2 c3
     echo   $?
        c=("address@hidden");}
a x set y z;declare -p a
b x set y z;declare -p b
c x set y z;declare -p c

#output:

#"${@:2}a3 a2" a$1    #works as long as $1 and 3 are swapped
#set y za3 a2 ax
#0
#declare -a a='([0]="y" [1]="za3 a2" [2]="ax")'

#"${@:2}b$1 b2" b3    #fails!  why?
#set y zbx b2 b3
#bash: set y zbx b2: command not found
#127
#declare -a b='([0]="x" [1]="set" [2]="y" [3]="z")'

#${@:2}c$1 c2 c3     #works as long as quoting omitted
#set y zcx c2 c3
#0
#declare -a c='([0]="y" [1]="zcx" [2]="c2" [3]="c3")'



reply via email to

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