mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-07-03 02:10:50 +02:00
commit bash-20041118 snapshot
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
BUILD_DIR=/usr/local/build/chet/bash/bash-current
|
||||
BUILD_DIR=/usr/local/build/bash/bash-current
|
||||
THIS_SH=$BUILD_DIR/bash
|
||||
PATH=$PATH:$BUILD_DIR
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
14
|
||||
1 2 3 4 5 6
|
||||
1 2 3 4 51 6
|
||||
5
|
||||
14
|
||||
7
|
||||
42
|
||||
1 2 3 4 12
|
||||
18
|
||||
1 2 3 4 18
|
||||
1 2 7 4 5
|
||||
1 2 7 13 5 9
|
||||
14
|
||||
9
|
||||
4
|
||||
9
|
||||
16
|
||||
./appendop.tests: line 83: x: readonly variable
|
||||
@@ -0,0 +1,83 @@
|
||||
# basic cases
|
||||
a=1
|
||||
a+=4
|
||||
echo $a
|
||||
|
||||
x=(1 2 3)
|
||||
x+=(4 5 6)
|
||||
|
||||
echo ${x[@]}
|
||||
|
||||
x[4]+=1
|
||||
echo ${x[@]}
|
||||
|
||||
# trickier cases
|
||||
|
||||
a+=5 printenv a
|
||||
echo $a
|
||||
|
||||
# if the integer flag is set, ksh93 appears to do arithmetic += and evaluate
|
||||
# old value as an arithmetic expression
|
||||
a=
|
||||
typeset -i a
|
||||
a+=7
|
||||
echo $a
|
||||
|
||||
b=4+1
|
||||
typeset -i b
|
||||
b+=37
|
||||
|
||||
echo $b
|
||||
|
||||
unset x
|
||||
x=(1 2 3 4 5)
|
||||
|
||||
typeset -i x
|
||||
|
||||
x[4]+=7
|
||||
|
||||
echo ${x[@]}
|
||||
|
||||
unset x
|
||||
typeset -i x
|
||||
|
||||
x=([0]=7+11)
|
||||
echo ${x[@]}
|
||||
|
||||
unset x
|
||||
x=(1 2 3 4 5)
|
||||
|
||||
typeset -i x
|
||||
|
||||
#x[4]=7+11
|
||||
|
||||
x=(1 2 3 4 [4]=7+11 )
|
||||
echo ${x[@]}
|
||||
|
||||
x=( 1 2 [2]+=7 4 5 )
|
||||
echo ${x[@]}
|
||||
|
||||
x+=( [3]+=9 [5]=9 )
|
||||
echo ${x[@]}
|
||||
|
||||
unset a
|
||||
a=1
|
||||
export a+=4
|
||||
printenv a
|
||||
printenv a+
|
||||
|
||||
unset x
|
||||
typeset -i x=4+5
|
||||
echo $x
|
||||
|
||||
unset x
|
||||
typeset x+=4
|
||||
echo $x
|
||||
|
||||
typeset -i x+=5
|
||||
echo $x
|
||||
|
||||
readonly x+=7
|
||||
echo $x
|
||||
|
||||
x+=5
|
||||
+18
-1
@@ -479,4 +479,21 @@ argv[1] = </full/path/to>
|
||||
argv[1] = </>
|
||||
argv[1] = <full/path/to/x16>
|
||||
argv[1] = <x16>
|
||||
./new-exp.tests: line 545: ABXD: parameter unset
|
||||
two
|
||||
one
|
||||
ne
|
||||
one
|
||||
|
||||
one
|
||||
one
|
||||
one
|
||||
1 2 3 4 5 6 7 8 9
|
||||
9
|
||||
9
|
||||
0
|
||||
9
|
||||
8 9
|
||||
123456789
|
||||
9
|
||||
9
|
||||
./new-exp.tests: line 547: ABXD: parameter unset
|
||||
|
||||
@@ -540,6 +540,8 @@ recho ${1%%[!/]*}
|
||||
recho ${1#*/}
|
||||
recho ${1##*/}
|
||||
|
||||
${THIS_SH} ./new-exp5.sub
|
||||
|
||||
# this must be last!
|
||||
expect $0: 'ABXD: parameter unset'
|
||||
recho ${ABXD:?"parameter unset"}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
x=(one two)
|
||||
echo ${x[@]:1}
|
||||
echo ${x[@]:0:1}
|
||||
|
||||
x=(one)
|
||||
echo ${x[0]:1}
|
||||
echo ${x[0]:0}
|
||||
echo ${x[@]:1}
|
||||
echo ${x[@]:0}
|
||||
|
||||
echo ${x[@]: -1}
|
||||
echo ${x[@]: ${#x[@]}-1}
|
||||
|
||||
x=(0 1 2 3 4 5 6 7 8 9)
|
||||
echo ${x[@]:1}
|
||||
|
||||
echo ${x[@]: -1}
|
||||
echo ${x[@]: ${#x[@]}-1}
|
||||
|
||||
set -- ${x[@]}
|
||||
|
||||
echo $1
|
||||
echo ${@: -1}
|
||||
echo ${@: $#-1}
|
||||
|
||||
a=0123456789
|
||||
|
||||
echo ${a:1}
|
||||
echo ${a: -1}
|
||||
echo ${a: ${#a}-1}
|
||||
@@ -0,0 +1,2 @@
|
||||
${THIS_SH} ./appendop.tests > /tmp/xx 2>&1
|
||||
diff /tmp/xx appendop.right && rm -f /tmp/xx
|
||||
Reference in New Issue
Block a user