]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/appendop.tests
Bash-4.3 patch 22
[thirdparty/bash.git] / tests / appendop.tests
CommitLineData
95732b49
JA
1# basic cases
2a=1
3a+=4
4echo $a
5
6x=(1 2 3)
7x+=(4 5 6)
8
9echo ${x[@]}
10
11x[4]+=1
12echo ${x[@]}
13
14# trickier cases
ac50fbac
CR
15# post-bash-4.2: bash understands += in environment assignments preceding
16# command names
95732b49
JA
17a+=5 printenv a
18echo $a
19
20# if the integer flag is set, ksh93 appears to do arithmetic += and evaluate
21# old value as an arithmetic expression
22a=
23typeset -i a
24a+=7
25echo $a
26
27b=4+1
28typeset -i b
29b+=37
30
31echo $b
32
33unset x
34x=(1 2 3 4 5)
35
36typeset -i x
37
38x[4]+=7
39
40echo ${x[@]}
41
42unset x
43typeset -i x
44
45x=([0]=7+11)
46echo ${x[@]}
47
48unset x
49x=(1 2 3 4 5)
50
51typeset -i x
52
53#x[4]=7+11
54
55x=(1 2 3 4 [4]=7+11 )
56echo ${x[@]}
57
58x=( 1 2 [2]+=7 4 5 )
59echo ${x[@]}
60
61x+=( [3]+=9 [5]=9 )
62echo ${x[@]}
63
64unset a
65a=1
66export a+=4
67printenv a
68printenv a+
69
70unset x
71typeset -i x=4+5
72echo $x
73
74unset x
75typeset x+=4
76echo $x
77
78typeset -i x+=5
79echo $x
80
81readonly x+=7
82echo $x
83
84x+=5
ac50fbac
CR
85
86${THIS_SH} ./appendop1.sub
87${THIS_SH} ./appendop2.sub