]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/dollar-at5.sub
Bash-4.3 patch 22
[thirdparty/bash.git] / tests / dollar-at5.sub
1 args() { printf '<%s> ' "$@"; echo; }
2
3 set -- 1 2 3 4 5
4
5 args "${@} ${1}"
6 args "${1} ${@}"
7 args "${1}${@}${1}"
8 args "${1} ${@} ${1}"
9 args ${1}"$@"${1}
10 args "$@"${1}
11 args ${1}"$@"
12
13 args "$@""${1}"
14 args "${1}""$@"
15
16 args "${@}foo"
17 args ${@}${1}
18 args ${@}foo
19
20 IFS=
21 args "$@""${1}"
22 args "${1}""$@"
23
24 args ${@}${1}
25 args ${1}${@}
26 args ${@}foo
27
28 echo second set:
29 IFS=$' \t\n'
30 set -- '1 2' 3 4 5
31
32 args "${@} ${1}"
33 args "${1} ${@}"
34
35 args "${1}${@}${1}"
36 args "${1} ${@} ${1}"
37 args ${1}"$@"${1}
38 args "$@"${1}
39 args ${1}"$@"
40
41 args "$@""${1}"
42 args "${1}""$@"
43
44 args "${@}foo"
45 args ${@}${1}
46 args ${@}foo
47
48 IFS=
49
50 args "$@""${1}"
51 args "${1}""$@"
52
53 args ${@}${1}
54 args ${1}${@}
55 args ${@}foo
56
57 echo third set:
58 IFS=$' \t\n'
59
60 alias declare=typeset
61
62 a(){ echo
63 echo '"${@:2}a3 a2" a$1 #works as long as $1 and 3 are swapped'
64 echo "${@:2}a3 a2" a$1
65 "${@:2}a3 a2" a$1
66 echo $?
67 a=("${@}");}
68 b(){ echo
69 echo '"${@:2}b$1 b2" b3 #fails! why?'
70 echo "${@:2}b$1 b2" b3
71 "${@:2}b$1 b2" b3
72 echo $?
73 b=("${@}");}
74 c(){ echo
75 echo '${@:2}c$1 c2 c3 #works as long as quoting omitted'
76 echo ${@:2}c$1 c2 c3
77 ${@:2}c$1 c2 c3
78 echo $?
79 c=("${@}");}
80 a x set y z;declare -p a
81 b x set y z;declare -p b
82 c x set y z;declare -p c