mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-05 17:52:30 +02:00
Imported from ../bash-2.05a.tar.gz.
This commit is contained in:
+2
-1
@@ -136,8 +136,8 @@ echo $(( 32#A ))
|
||||
echo $(( 56#A ))
|
||||
echo $(( 64#A ))
|
||||
|
||||
echo $(( 64#_ ))
|
||||
echo $(( 64#@ ))
|
||||
echo $(( 64#_ ))
|
||||
|
||||
# weird bases
|
||||
echo $(( 3425#56 ))
|
||||
@@ -265,6 +265,7 @@ echo $x $y
|
||||
(( x=9 y=41 ))
|
||||
|
||||
# These are errors
|
||||
unset b
|
||||
echo $((a b))
|
||||
((a b))
|
||||
|
||||
|
||||
+8
-9
@@ -27,7 +27,6 @@ declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
|
||||
declare -ar c='()'
|
||||
readonly -a a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
|
||||
readonly -a c='()'
|
||||
./array.tests: declare: e: cannot assign to array variables in this way
|
||||
a test
|
||||
declare -a DIRSTACK='()'
|
||||
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
|
||||
@@ -111,14 +110,14 @@ for case if then else
|
||||
12 14 16 18 20
|
||||
4414758999202
|
||||
aaa bbb
|
||||
./array.tests: array assign: line 262: syntax error near unexpected token `for'
|
||||
./array.tests: array assign: line 262: `a b c for case if then else'
|
||||
./array.tests: array assign: line 264: syntax error near unexpected token `for'
|
||||
./array.tests: array assign: line 264: `for case if then else'
|
||||
./array.tests: array assign: line 266: syntax error near unexpected token `<>'
|
||||
./array.tests: array assign: line 266: ` <> < > ! '
|
||||
./array.tests: array assign: line 267: syntax error near unexpected token `[1]=<>'
|
||||
./array.tests: array assign: line 267: ` [1]=<> [2]=< [3]=> [4]=! '
|
||||
./array.tests: array assign: line 263: syntax error near unexpected token `for'
|
||||
./array.tests: array assign: line 263: `a b c for case if then else'
|
||||
./array.tests: array assign: line 265: syntax error near unexpected token `for'
|
||||
./array.tests: array assign: line 265: `for case if then else'
|
||||
./array.tests: array assign: line 267: syntax error near unexpected token `<>'
|
||||
./array.tests: array assign: line 267: ` <> < > ! '
|
||||
./array.tests: array assign: line 268: syntax error near unexpected token `[1]=<>'
|
||||
./array.tests: array assign: line 268: ` [1]=<> [2]=< [3]=> [4]=! '
|
||||
abc 3
|
||||
0
|
||||
abc 1
|
||||
|
||||
+2
-1
@@ -21,6 +21,7 @@ unset a
|
||||
a=abcde
|
||||
a[2]=bdef
|
||||
|
||||
unset b
|
||||
declare -a b[256]
|
||||
|
||||
unset c[2]
|
||||
@@ -78,7 +79,7 @@ set +o posix
|
||||
declare -a d='([1]="" [2]="bdef" [5]="hello world" "test")'
|
||||
d[9]="ninth element"
|
||||
|
||||
declare -a e[10]=test
|
||||
declare -a e[10]=test # this works in post-bash-2.05 versions
|
||||
declare -a e[10]='(test)'
|
||||
|
||||
pass=/etc/passwd
|
||||
|
||||
@@ -45,11 +45,11 @@ $BVAR
|
||||
foo
|
||||
bar
|
||||
xxx
|
||||
022
|
||||
0022
|
||||
u=rwx,g=rx,o=rx
|
||||
002
|
||||
0002
|
||||
u=rwx,g=rwx,o=rx
|
||||
umask 002
|
||||
umask 0002
|
||||
umask -S u=rwx,g=rwx,o=rx
|
||||
u=rwx,g=rwx,o=rwx
|
||||
enable .
|
||||
|
||||
+1
-3
@@ -31,14 +31,13 @@ exec: usage: exec [-cl] [-a name] file [redirection ...]
|
||||
./errors.tests: logout: not login shell: use `exit'
|
||||
./errors.tests: hash: notthere: not found
|
||||
./errors.tests: hash: illegal option: -v
|
||||
hash: usage: hash [-r] [-p pathname] [name ...]
|
||||
hash: usage: hash [-r] [-p pathname] [-t] [name ...]
|
||||
./errors.tests: hash: hashing disabled
|
||||
./errors.tests: export: `AA[4]': not a valid identifier
|
||||
./errors.tests: readonly: `AA[4]': not a valid identifier
|
||||
./errors.tests: [-2]: bad array subscript
|
||||
./errors.tests: AA: readonly variable
|
||||
./errors.tests: AA: readonly variable
|
||||
./errors.tests: readonly: ZZZ: cannot assign to array variables in this way
|
||||
./errors.tests: shift: shift count must be <= $#
|
||||
./errors.tests: shift: shift count must be >= 0
|
||||
./errors.tests: shopt: no_such_option: unknown shell option name
|
||||
@@ -86,7 +85,6 @@ command: usage: command [-pVv] command [arg ...]
|
||||
./errors.tests: trap: NOSIG: not a signal specification
|
||||
./errors.tests: trap: illegal option: -s
|
||||
trap: usage: trap [arg] [signal_spec ...] or trap -l
|
||||
./errors.tests: trap: ERR: not a signal specification
|
||||
./errors.tests: return: can only `return' from a function or sourced script
|
||||
./errors.tests: break: loop count must be > 0
|
||||
./errors.tests: continue: loop count must be > 0
|
||||
|
||||
+4
-3
@@ -121,7 +121,8 @@ readonly -n AA
|
||||
AA=(one two three)
|
||||
|
||||
# try to assign a readonly array with bad assignment syntax
|
||||
readonly -a ZZZ=bbb
|
||||
# NOTE: this works in post-bash-2.05 (at least when I write this)
|
||||
# readonly -a ZZZ=bbb
|
||||
|
||||
# bad counts to `shift'
|
||||
shopt -s shift_verbose
|
||||
@@ -217,8 +218,8 @@ trap -p NOSIG
|
||||
# maybe someday trap will take a -s argument like kill, but not now
|
||||
trap -p -s NOSIG
|
||||
|
||||
# maybe someday we will have a ksh-like ERR trap, but not yet
|
||||
trap 'echo [$LINENO] -- error' ERR
|
||||
# we have a ksh-like ERR trap, post-bash-2.05
|
||||
#trap 'echo [$LINENO] -- error' ERR
|
||||
|
||||
# can only return from a function or sourced script
|
||||
return 2
|
||||
|
||||
+1
-2
@@ -17,8 +17,7 @@ notthere: notthere: No such file or directory
|
||||
./execscript: .: /: is a directory
|
||||
1
|
||||
127
|
||||
./execscript: .: /dev/null: not a regular file
|
||||
1
|
||||
0
|
||||
this is bashenv
|
||||
./exec3.sub: /tmp/bash-notthere: No such file or directory
|
||||
./exec3.sub: exec: /tmp/bash-notthere: cannot execute: No such file or directory
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
export LC_ALL=C
|
||||
export LANG=C
|
||||
|
||||
if (( $UID == 0 )); then
|
||||
echo "execscript: the test suite should not be run as root" >&2
|
||||
fi
|
||||
|
||||
set -- one two three
|
||||
echo before exec1.sub: "$@"
|
||||
echo calling exec1.sub
|
||||
@@ -40,6 +44,7 @@ echo $?
|
||||
. ${THIS_SH} 2>/dev/null
|
||||
echo $?
|
||||
|
||||
# post-bash-2.05 versions allow sourcing non-regular files
|
||||
. /dev/null
|
||||
echo $?
|
||||
|
||||
|
||||
+3
-3
@@ -146,14 +146,14 @@ fi
|
||||
newtest
|
||||
SQUOTE="'"
|
||||
val1=$(set | sed -n 's:^SQUOTE=::p')
|
||||
if [ "$val1" != "\$'\\''" ]; then
|
||||
if [ "$val1" != "''\\'''" ]; then
|
||||
testfail "variable quoting 1"
|
||||
fi
|
||||
|
||||
newtest
|
||||
VTILDE='~'
|
||||
val1=$(set | sed -n 's:^VTILDE=::p')
|
||||
if [ "$val1" != "\$'~'" ]; then
|
||||
if [ "$val1" != "'~'" ]; then
|
||||
testfail "variable quoting 2"
|
||||
fi
|
||||
|
||||
@@ -167,7 +167,7 @@ fi
|
||||
newtest
|
||||
VHASH2=#abcd
|
||||
val1=$(set | sed -n 's:^VHASH2=::p')
|
||||
if [ "$val1" != "\$'#abcd'" ]; then
|
||||
if [ "$val1" != "'#abcd'" ]; then
|
||||
testfail "variable quoting 4"
|
||||
fi
|
||||
|
||||
|
||||
Binary file not shown.
+16
-2
@@ -61,11 +61,11 @@ printf -- "--%b--\n" '\t\101'
|
||||
|
||||
# these should all display `A7'
|
||||
echo -e "\1017"
|
||||
echo -e "\x0417"
|
||||
echo -e "\x417"
|
||||
|
||||
printf "%b\n" '\01017'
|
||||
printf "%b\n" '\1017'
|
||||
printf "%b\n" '\x0417'
|
||||
printf "%b\n" '\x417'
|
||||
|
||||
printf -- "--%b--\n" '\"abcd\"'
|
||||
printf -- "--%b--\n" "\'abcd\'"
|
||||
@@ -206,5 +206,19 @@ printf "ab%Mcd\n"
|
||||
# this caused an infinite loop in older versions of printf
|
||||
printf "%y" 0
|
||||
|
||||
# these should print a warning and `0', according to POSIX.2
|
||||
printf "%d\n" GNU
|
||||
printf "%o\n" GNU
|
||||
|
||||
# failures in all bash versions through bash-2.05
|
||||
printf "%.0s" foo
|
||||
printf "%.*s" 0 foo
|
||||
|
||||
printf '%.0b-%.0s\n' foo bar
|
||||
printf '(%*b)(%*s)\n' -4 foo -4 bar
|
||||
|
||||
format='%'`printf '%0100384d' 0`'d\n'
|
||||
printf $format 0
|
||||
|
||||
# this doesn't work with printf(3) on all systems
|
||||
#printf "%'s\n" foo
|
||||
|
||||
@@ -17,6 +17,7 @@ shopt -s hostcomplete
|
||||
shopt -u huponexit
|
||||
shopt -s interactive_comments
|
||||
shopt -u lithist
|
||||
shopt -u login_shell
|
||||
shopt -u mailwarn
|
||||
shopt -u no_empty_cmd_completion
|
||||
shopt -u nocaseglob
|
||||
@@ -52,6 +53,7 @@ shopt -u histappend
|
||||
shopt -u histverify
|
||||
shopt -u huponexit
|
||||
shopt -u lithist
|
||||
shopt -u login_shell
|
||||
shopt -u mailwarn
|
||||
shopt -u no_empty_cmd_completion
|
||||
shopt -u nocaseglob
|
||||
@@ -71,6 +73,7 @@ histappend off
|
||||
histverify off
|
||||
huponexit off
|
||||
lithist off
|
||||
login_shell off
|
||||
mailwarn off
|
||||
no_empty_cmd_completion off
|
||||
nocaseglob off
|
||||
@@ -99,6 +102,7 @@ set +o xtrace
|
||||
set -o history
|
||||
set +o ignoreeof
|
||||
set -o interactive-comments
|
||||
set +o nolog
|
||||
set +o posix
|
||||
set -o emacs
|
||||
set +o vi
|
||||
@@ -123,6 +127,7 @@ xtrace off
|
||||
history on
|
||||
ignoreeof off
|
||||
interactive-comments on
|
||||
nolog off
|
||||
posix off
|
||||
emacs on
|
||||
vi off
|
||||
@@ -147,6 +152,7 @@ set +o xtrace
|
||||
set -o history
|
||||
set +o ignoreeof
|
||||
set -o interactive-comments
|
||||
set +o nolog
|
||||
set +o posix
|
||||
set -o emacs
|
||||
set +o vi
|
||||
@@ -176,6 +182,7 @@ set +o physical
|
||||
set +o verbose
|
||||
set +o xtrace
|
||||
set +o ignoreeof
|
||||
set +o nolog
|
||||
set +o posix
|
||||
set +o vi
|
||||
--
|
||||
@@ -192,6 +199,7 @@ physical off
|
||||
verbose off
|
||||
xtrace off
|
||||
ignoreeof off
|
||||
nolog off
|
||||
posix off
|
||||
vi off
|
||||
--
|
||||
|
||||
@@ -45,6 +45,16 @@ trap -- 'echo aborting' SIGQUIT
|
||||
trap -- 'echo aborting' SIGABRT
|
||||
trap -- 'echo aborting' SIGTERM
|
||||
0
|
||||
ERRTRAP
|
||||
ERRTRAP
|
||||
ERRTRAP
|
||||
after falses
|
||||
if negation ok
|
||||
after negation
|
||||
after while
|
||||
before false in trap2a.sub
|
||||
after false in trap2a.sub
|
||||
command substitution
|
||||
caught a child death
|
||||
caught a child death
|
||||
caught a child death
|
||||
|
||||
@@ -53,6 +53,9 @@ echo $?
|
||||
trap '' USR2
|
||||
./trap1.sub
|
||||
|
||||
# test ERR trap
|
||||
./trap2.sub
|
||||
|
||||
#
|
||||
# show that setting a trap on SIGCHLD is not disastrous.
|
||||
#
|
||||
@@ -71,3 +74,4 @@ trap -p SIGCHLD
|
||||
trap SIGINT QUIT TERM
|
||||
|
||||
trap
|
||||
|
||||
|
||||
Executable
+25
@@ -0,0 +1,25 @@
|
||||
set +e
|
||||
trap 'echo ERRTRAP' ERR
|
||||
|
||||
false
|
||||
false
|
||||
false
|
||||
|
||||
echo after falses
|
||||
|
||||
if ! false; then
|
||||
echo if negation ok
|
||||
fi
|
||||
|
||||
! false
|
||||
echo after negation
|
||||
|
||||
while false; do
|
||||
echo while negation ok
|
||||
done
|
||||
|
||||
echo after while
|
||||
|
||||
./trap2a.sub
|
||||
|
||||
echo $(false ; echo command substitution)
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
echo before false in trap2a.sub
|
||||
false
|
||||
echo after false in trap2a.sub
|
||||
Reference in New Issue
Block a user