mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-27 23:53:18 +02:00
commit bash-20041027 snapshot
This commit is contained in:
@@ -236,6 +236,9 @@ echo "value = ${barray[*]}"
|
||||
set -u
|
||||
( echo ${#narray[4]} )
|
||||
|
||||
${THIS_SH} ./array1.sub
|
||||
${THIS_SH} ./array2.sub
|
||||
|
||||
# some old bugs and ksh93 compatibility tests
|
||||
set +u
|
||||
cd /tmp
|
||||
@@ -332,3 +335,62 @@ echo ${av[@]: -1:2}
|
||||
|
||||
echo out-of-range offset
|
||||
echo ${av[@]:12}
|
||||
|
||||
# parsing problems and other inconsistencies not fixed until post bash-3.0
|
||||
unset x
|
||||
declare -a x=(')' $$)
|
||||
[ ${x[1]} -eq $$ ] || echo bad
|
||||
|
||||
unset x
|
||||
declare -a x=(a b c d e)
|
||||
echo ${x[4]}
|
||||
|
||||
z=([1]=one [4]=four [7]=seven [10]=ten)
|
||||
|
||||
echo ${#z[@]}
|
||||
|
||||
echo ${!z[@]}
|
||||
|
||||
unset x
|
||||
declare -a x=(a \'b c\')
|
||||
|
||||
echo "${x[1]}"
|
||||
|
||||
unset x
|
||||
declare -a x=(a 'b c')
|
||||
|
||||
echo "${x[1]}"
|
||||
|
||||
unset x
|
||||
declare -a x=($0)
|
||||
[ "${x[@]}" = $0 ] || echo double expansion of \$0
|
||||
declare -a x=(\$0)
|
||||
echo "${x[@]}"
|
||||
|
||||
: ${TMPDIR:=/tmp}
|
||||
|
||||
mkdir $TMPDIR/bash-test-$$
|
||||
cd $TMPDIR/bash-test-$$
|
||||
|
||||
trap "cd / ; rm -rf $TMPDIR/bash-test/$$" 0 1 2 3 6 15
|
||||
|
||||
touch '[3]=abcde'
|
||||
|
||||
touch r s t u v
|
||||
|
||||
declare -a x=(*)
|
||||
|
||||
echo ${x[3]}
|
||||
echo ${x[@]}
|
||||
|
||||
unset x
|
||||
x=(a b c d e)
|
||||
|
||||
echo ${x[*]: -1}
|
||||
|
||||
unset x[4]
|
||||
unset x[2]
|
||||
|
||||
x[9]='9'
|
||||
|
||||
echo ${x[*]: -1}
|
||||
|
||||
Reference in New Issue
Block a user