Imported from ../bash-2.05b.tar.gz.

This commit is contained in:
Jari Aalto
2009-09-12 16:46:55 +00:00
parent f73dda092b
commit 7117c2d221
362 changed files with 34387 additions and 15063 deletions
+24 -24
View File
@@ -59,7 +59,7 @@
1,i+=2
30
1,j+=2
./arith.tests: 1 ? 20 : x+=2: attempted assignment to non-variable (error token is "+=2")
./arith.tests: line 108: 1 ? 20 : x+=2: attempted assignment to non-variable (error token is "+=2")
20
6
6,5,3
@@ -79,16 +79,16 @@
36
62
63
./arith.tests: 3425#56: illegal arithmetic base (error token is "3425#56")
./arith.tests: line 143: 3425#56: illegal arithmetic base (error token is "3425#56")
0
./arith.tests: 7 = 43 : attempted assignment to non-variable (error token is "= 43 ")
./arith.tests: 2#44: value too great for base (error token is "2#44")
./arith.tests: 44 / 0 : division by 0 (error token is " ")
./arith.tests: let: jv += $iv: syntax error: operand expected (error token is "$iv")
./arith.tests: jv += $iv : syntax error: operand expected (error token is "$iv ")
./arith.tests: let: rv = 7 + (43 * 6: missing `)' (error token is "6")
./arith.tests: 0#4: bad number (error token is "0#4")
./arith.tests: 2#110#11: bad number (error token is "2#110#11")
./arith.tests: line 149: 7 = 43 : attempted assignment to non-variable (error token is "= 43 ")
./arith.tests: line 150: 2#44: value too great for base (error token is "2#44")
./arith.tests: line 151: 44 / 0 : division by 0 (error token is " ")
./arith.tests: line 152: let: jv += $iv: syntax error: operand expected (error token is "$iv")
./arith.tests: line 153: jv += $iv : syntax error: operand expected (error token is "$iv ")
./arith.tests: line 154: let: rv = 7 + (43 * 6: missing `)' (error token is "6")
./arith.tests: line 158: 0#4: bad number (error token is "0#4")
./arith.tests: line 159: 2#110#11: bad number (error token is "2#110#11")
abc
def
ghi
@@ -96,15 +96,15 @@ ok
6
1
0
./arith.tests: 4 + : syntax error: operand expected (error token is " ")
./arith.tests: line 177: 4 + : syntax error: operand expected (error token is " ")
16
./arith.tests: 4 ? : 3 + 5 : expression expected (error token is ": 3 + 5 ")
./arith.tests: 1 ? 20 : `:' expected for conditional expression (error token is " ")
./arith.tests: 4 ? 20 : : expression expected (error token is " ")
./arith.tests: line 182: 4 ? : 3 + 5 : expression expected (error token is ": 3 + 5 ")
./arith.tests: line 183: 1 ? 20 : `:' expected for conditional expression (error token is " ")
./arith.tests: line 184: 4 ? 20 : : expression expected (error token is " ")
9
./arith.tests: 0 && B=42 : attempted assignment to non-variable (error token is "=42 ")
./arith.tests: line 190: 0 && B=42 : attempted assignment to non-variable (error token is "=42 ")
9
./arith.tests: 1 || B=88 : attempted assignment to non-variable (error token is "=88 ")
./arith.tests: line 193: 1 || B=88 : attempted assignment to non-variable (error token is "=88 ")
9
0
9
@@ -130,20 +130,20 @@ ok
4
4
7
./arith.tests: 7-- : syntax error: operand expected (error token is " ")
./arith.tests: --x=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: ++x=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: x++=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: x--=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: line 241: 7-- : syntax error: operand expected (error token is " ")
./arith.tests: line 243: --x=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: line 244: ++x=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: line 246: x++=7 : attempted assignment to non-variable (error token is "=7 ")
./arith.tests: line 247: x--=7 : attempted assignment to non-variable (error token is "=7 ")
4
7
-7
7
7
8 12
./arith.tests: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
./arith.tests: a b: syntax error in expression (error token is "b")
./arith.tests: ((: a b: syntax error in expression (error token is "b")
./arith.tests: line 265: ((: x=9 y=41 : syntax error in expression (error token is "y=41 ")
./arith.tests: line 269: a b: syntax error in expression (error token is "b")
./arith.tests: line 270: ((: a b: syntax error in expression (error token is "b")
42
42
42
+31 -30
View File
@@ -1,5 +1,6 @@
./array.tests: array assign: line 10: syntax error near unexpected token `&'
./array.tests: array assign: line 10: `first & second'
./array.tests: line 15: syntax error near unexpected token `&'
./array.tests: line 15: `test=(first & second)'
1
abcde
abcde
@@ -20,7 +21,7 @@ hello world
11
3
bdef hello world test expression
./array.tests: readonly: `a[5]': not a valid identifier
./array.tests: line 74: readonly: `a[5]': not a valid identifier
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -ar c='()'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
@@ -35,25 +36,25 @@ declare -ar c='()'
declare -a d='([1]="" [2]="bdef" [5]="hello world" [6]="test" [9]="ninth element")'
declare -a e='([0]="test")'
declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
./array.tests: a: readonly variable
./array.tests: b[]: bad array subscript
./array.tests: b[*]: bad array subscript
./array.tests: ${b[ ]}: bad substitution
./array.tests: c[-2]: bad array subscript
./array.tests: c: bad array subscript
./array.tests: line 98: a: readonly variable
./array.tests: line 100: b[]: bad array subscript
./array.tests: line 101: b[*]: bad array subscript
./array.tests: line 102: ${b[ ]}: bad substitution
./array.tests: line 104: c[-2]: bad array subscript
./array.tests: line 105: c: bad array subscript
./array.tests: d[7]: cannot assign list to array member
./array.tests: []=abcde: bad array subscript
./array.tests: [*]=last: cannot assign to non-numeric index
./array.tests: [-65]=negative: bad array subscript
./array.tests: line 107: d[7]: cannot assign list to array member
./array.tests: line 109: []=abcde: bad array subscript
./array.tests: line 109: [*]=last: cannot assign to non-numeric index
./array.tests: line 109: [-65]=negative: bad array subscript
declare -a DIRSTACK='()'
declare -ar a='([1]="" [2]="bdef" [5]="hello world" [6]="test expression")'
declare -a b='([0]="this" [1]="is" [2]="a" [3]="test" [4]="" [5]="/etc/passwd")'
declare -ar c='()'
declare -a d='([1]="test test")'
declare -a f='([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element")'
./array.tests: unset: ps1: not an array variable
./array.tests: declare: c: cannot destroy array variables in this way
./array.tests: line 117: unset: ps1: not an array variable
./array.tests: line 121: declare: c: cannot destroy array variables in this way
this of
this is a test of read using arrays
this test
@@ -88,6 +89,10 @@ bin bin ucb bin . sbin sbin
bin
/ / / / / /
/
argv[1] = <bin>
argv[1] = </>
argv[1] = <sbin>
argv[1] = </>
\bin \usr/bin \usr/ucb \usr/local/bin . \sbin \usr/sbin
\bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
\bin \usr\bin \usr\ucb \usr\local\bin . \sbin \usr\sbin
@@ -102,7 +107,7 @@ grep [ 123 ] *
6 7 9 5
length = 3
value = new1 new2 new3
./array.tests: narray: unbound variable
./array.tests: line 237: narray: unbound variable
a b c d e f g
for case if then else
@@ -110,19 +115,15 @@ for case if then else
12 14 16 18 20
4414758999202
aaa bbb
./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]=! '
./array.tests: line 277: syntax error near unexpected token `<>'
./array.tests: line 277: `metas=( <> < > ! )'
./array.tests: line 278: syntax error near unexpected token `<>'
./array.tests: line 278: `metas=( [1]=<> [2]=< [3]=> [4]=! )'
abc 3
case 4
abc case if then else 5
abc case if then else 5
0
abc 1
abc 1
0
0
1
1
case 4
case if then else 5
case if then else 5
+11 -1
View File
@@ -6,6 +6,11 @@ set +a
# The calls to egrep -v are to filter out builtin array variables that are
# automatically set and possibly contain values that vary.
# first make sure we handle the basics
x=()
echo ${x[@]}
unset x
# this should be an error
test=(first & second)
echo $?
@@ -171,6 +176,10 @@ echo ${xpath[@]##*/}
echo ${xpath[0]##*/}
echo ${xpath[@]%%[!/]*}
echo ${xpath[0]%%[!/]*}
recho ${xpath##*/}
recho ${xpath%%[!/]*}
recho ${xpath[5]##*/}
recho ${xpath[5]%%[!/]*}
# let's try to make it a DOS-style path
@@ -259,11 +268,12 @@ declare -a ddd=(aaa
bbb)
echo ${ddd[@]}
# errors
# errors until post-bash-2.05a; now reserved words are OK
foo=(a b c for case if then else)
foo=(for case if then else)
# errors
metas=( <> < > ! )
metas=( [1]=<> [2]=< [3]=> [4]=! )
+5 -5
View File
@@ -105,9 +105,9 @@ m n o p
/tmp/bash-dir-a
/tmp/bash-dir-a
/tmp/bash-dir-a
./source5.sub: /tmp/source-notthere: No such file or directory
./source5.sub: line 10: /tmp/source-notthere: No such file or directory
after bad source 1
./source5.sub: /tmp/source-notthere: No such file or directory
./source5.sub: line 17: /tmp/source-notthere: No such file or directory
AVAR
foo
foo
@@ -118,15 +118,15 @@ AVAR
foo
declare -x foo=""
declare -x FOO="\$\$"
./builtins.tests: declare: FOO: not found
./builtins.tests: line 219: declare: FOO: not found
declare -x FOO="\$\$"
ok
ok
./builtins.tests: kill: bad signal number: 4096
./builtins.tests: line 251: kill: 4096: invalid signal specification
1
a\n\n\nb
a
b
./builtins.tests: exit: bad non-numeric arg `status'
./builtins.tests: line 260: exit: status: numeric argument required
+1 -1
View File
@@ -23,7 +23,7 @@ returns: 0
returns: 1
returns: 1
returns: 0
./cond.tests: [[: 4+: syntax error: operand expected (error token is "+")
./cond.tests: line 101: [[: 4+: syntax error: operand expected (error token is "+")
returns: 1
returns: 0
returns: 0
+13 -13
View File
@@ -1,13 +1,13 @@
./dstack.tests: pushd: /tmp/xxx-notthere: No such file or directory
./dstack.tests: pushd: no other directory
./dstack.tests: popd: directory stack empty
./dstack.tests: pushd: -m: bad argument
./dstack.tests: line 6: pushd: /tmp/xxx-notthere: No such file or directory
./dstack.tests: line 9: pushd: no other directory
./dstack.tests: line 10: popd: directory stack empty
./dstack.tests: line 13: pushd: -m: invalid number
pushd: usage: pushd [dir | +N | -N] [-n]
./dstack.tests: popd: -m: bad argument
./dstack.tests: line 14: popd: -m: invalid number
popd: usage: popd [+N | -N] [-n]
./dstack.tests: dirs: -m: bad argument
./dstack.tests: line 15: dirs: -m: invalid number
dirs: usage: dirs [-clpv] [+N] [-N]
./dstack.tests: dirs: unknown option: 7
./dstack.tests: line 16: dirs: 7: invalid option
dirs: usage: dirs [-clpv] [+N] [-N]
/
ok
@@ -31,12 +31,12 @@ ok
/tmp
/usr
/usr
./dstack.tests: dirs: 9: bad directory stack index
./dstack.tests: dirs: 9: bad directory stack index
./dstack.tests: pushd: +9: bad directory stack index
./dstack.tests: pushd: -9: bad directory stack index
./dstack.tests: popd: +9: bad directory stack index
./dstack.tests: popd: -9: bad directory stack index
./dstack.tests: line 58: dirs: 9: directory stack index out of range
./dstack.tests: line 58: dirs: 9: directory stack index out of range
./dstack.tests: line 59: pushd: +9: directory stack index out of range
./dstack.tests: line 59: pushd: -9: directory stack index out of range
./dstack.tests: line 60: popd: +9: directory stack index out of range
./dstack.tests: line 60: popd: -9: directory stack index out of range
/tmp /etc /
/tmp /etc /
/tmp /etc /
+84 -83
View File
@@ -1,99 +1,100 @@
./errors.tests: alias: illegal option: -x
./errors.tests: line 17: alias: -x: invalid option
alias: usage: alias [-p] [name[=value] ... ]
./errors.tests: unalias: illegal option: -x
./errors.tests: line 18: unalias: -x: invalid option
unalias: usage: unalias [-a] [name ...]
./errors.tests: alias: `hoowah' not found
./errors.tests: unalias: `hoowah': not an alias
./errors.tests: `1': not a valid identifier
./errors.tests: line 19: alias: hoowah: not found
./errors.tests: line 20: unalias: hoowah: not found
./errors.tests: line 23: `1': not a valid identifier
declare -fr func
./errors.tests: func: readonly function
./errors.tests: unset: illegal option: -x
./errors.tests: line 36: func: readonly function
./errors.tests: line 39: unset: -x: invalid option
unset: usage: unset [-f] [-v] [name ...]
./errors.tests: unset: func: cannot unset: readonly function
./errors.tests: declare: func: readonly function
./errors.tests: unset: XPATH: cannot unset: readonly variable
./errors.tests: unset: `/bin/sh': not a valid identifier
./errors.tests: unset: cannot simultaneously unset a function and a variable
./errors.tests: declare: unknown option: `-z'
declare: usage: declare [-afFrxi] [-p] name[=value] ...
./errors.tests: declare: `-z': not a valid identifier
./errors.tests: declare: `/bin/sh': not a valid identifier
./errors.tests: declare: cannot use `-f' to make functions
./errors.tests: exec: illegal option: -i
./errors.tests: line 42: unset: func: cannot unset: readonly function
./errors.tests: line 45: declare: func: readonly function
./errors.tests: line 49: unset: XPATH: cannot unset: readonly variable
./errors.tests: line 52: unset: `/bin/sh': not a valid identifier
./errors.tests: line 55: unset: cannot simultaneously unset a function and a variable
./errors.tests: line 58: declare: -z: invalid option
declare: usage: declare [-afFirtx] [-p] name[=value] ...
./errors.tests: line 60: declare: `-z': not a valid identifier
./errors.tests: line 61: declare: `/bin/sh': not a valid identifier
./errors.tests: line 65: declare: cannot use `-f' to make functions
./errors.tests: line 68: exec: -i: invalid option
exec: usage: exec [-cl] [-a name] file [redirection ...]
./errors.tests: export: XPATH: not a function
./errors.tests: break: only meaningful in a `for', `while', or `until' loop
./errors.tests: continue: only meaningful in a `for', `while', or `until' loop
./errors.tests: shift: bad non-numeric arg `label'
./errors.tests: shift: too many arguments
./errors.tests: let: expression expected
./errors.tests: local: can only be used in a function
./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] [-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: shift: shift count must be <= $#
./errors.tests: shift: shift count must be >= 0
./errors.tests: shopt: no_such_option: unknown shell option name
./errors.tests: shopt: no_such_option: unknown shell option name
./errors.tests: umask: `09' is not an octal number from 000 to 777
./errors.tests: umask: bad character in symbolic mode: :
./errors.tests: umask: bad symbolic mode operator: :
./errors.tests: umask: illegal option: -i
./errors.tests: line 72: export: XPATH: not a function
./errors.tests: line 75: break: only meaningful in a `for', `while', or `until' loop
./errors.tests: line 76: continue: only meaningful in a `for', `while', or `until' loop
./errors.tests: line 79: shift: label: numeric argument required
./errors.tests: line 84: shift: too many arguments
./errors.tests: line 90: let: expression expected
./errors.tests: line 93: local: can only be used in a function
./errors.tests: line 96: logout: not login shell: use `exit'
./errors.tests: line 99: hash: notthere: not found
./errors.tests: line 102: hash: -v: invalid option
hash: usage: hash [-lr] [-p pathname] [-dt] [name ...]
./errors.tests: line 106: hash: hashing disabled
./errors.tests: line 109: export: `AA[4]': not a valid identifier
./errors.tests: line 110: readonly: `AA[4]': not a valid identifier
./errors.tests: line 113: [-2]: bad array subscript
./errors.tests: line 117: AA: readonly variable
./errors.tests: line 121: AA: readonly variable
./errors.tests: line 129: shift: 5: shift count out of range
./errors.tests: line 130: shift: -2: shift count out of range
./errors.tests: line 133: shopt: no_such_option: invalid shell option name
./errors.tests: line 134: shopt: no_such_option: invalid shell option name
./errors.tests: line 137: umask: 09: octal number out of range
./errors.tests: line 138: umask: `:': invalid symbolic mode character
./errors.tests: line 139: umask: `:': invalid symbolic mode operator
./errors.tests: line 142: umask: -i: invalid option
umask: usage: umask [-p] [-S] [mode]
./errors.tests: umask: bad character in symbolic mode: u
./errors.tests: VAR: readonly variable
./errors.tests: declare: VAR: readonly variable
./errors.tests: declare: VAR: readonly variable
./errors.tests: declare: unset: not found
./errors.tests: VAR: readonly variable
./errors.tests: line 146: umask: `u': invalid symbolic mode character
./errors.tests: line 155: VAR: readonly variable
./errors.tests: line 158: declare: VAR: readonly variable
./errors.tests: line 159: declare: VAR: readonly variable
./errors.tests: line 161: declare: unset: not found
./errors.tests: line 164: VAR: readonly variable
./errors.tests: command substitution: line 2: syntax error: unexpected end of file
./errors.tests: command substitution: line 1: syntax error near unexpected token `done'
./errors.tests: command substitution: line 1: ` for z in 1 2 3; done '
./errors.tests: cd: HOME not set
./errors.tests: cd: /tmp/xyz.bash: No such file or directory
./errors.tests: cd: OLDPWD not set
./errors.tests: cd: /bin/sh: Not a directory
./errors.tests: cd: /tmp/cd-notthere: No such file or directory
./errors.tests: .: filename argument required
./errors.tests: line 171: cd: HOME not set
./errors.tests: line 172: cd: /tmp/xyz.bash: No such file or directory
./errors.tests: line 174: cd: OLDPWD not set
./errors.tests: line 175: cd: /bin/sh: Not a directory
./errors.tests: line 177: cd: /tmp/cd-notthere: No such file or directory
./errors.tests: line 180: .: filename argument required
.: usage: . filename
./errors.tests: source: filename argument required
./errors.tests: line 181: source: filename argument required
source: usage: source filename
./errors.tests: .: illegal option: -i
./errors.tests: line 184: .: -i: invalid option
.: usage: . filename
./errors.tests: set: unknown option: q
./errors.tests: enable: sh: not a shell builtin
./errors.tests: enable: bash: not a shell builtin
./errors.tests: shopt: cannot set and unset shell options simultaneously
./errors.tests: read: var: invalid timeout specification
./errors.tests: read: `/bin/sh': not a valid identifier
./errors.tests: VAR: readonly variable
./errors.tests: readonly: illegal option: -x
readonly: usage: readonly [-anf] [name ...] or readonly -p
./errors.tests: eval: illegal option: -i
./errors.tests: line 187: set: -q: invalid option
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
./errors.tests: line 190: enable: sh: not a shell builtin
./errors.tests: line 190: enable: bash: not a shell builtin
./errors.tests: line 193: shopt: cannot set and unset shell options simultaneously
./errors.tests: line 196: read: var: invalid timeout specification
./errors.tests: line 199: read: `/bin/sh': not a valid identifier
./errors.tests: line 202: VAR: readonly variable
./errors.tests: line 205: readonly: -x: invalid option
readonly: usage: readonly [-anf] [name[=value] ...] or readonly -p
./errors.tests: line 208: eval: -i: invalid option
eval: usage: eval [arg ...]
./errors.tests: command: illegal option: -i
./errors.tests: line 209: command: -i: invalid option
command: usage: command [-pVv] command [arg ...]
./errors.tests: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: trap: NOSIG: not a signal specification
./errors.tests: trap: illegal option: -s
./errors.tests: line 1: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 1: /bin/sh + 0: syntax error: operand expected (error token is "/bin/sh + 0")
./errors.tests: line 216: trap: NOSIG: invalid signal specification
./errors.tests: line 219: trap: -s: invalid option
trap: usage: trap [arg] [signal_spec ...] or trap -l
./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
./errors.tests: builtin: bash: not a shell builtin
./errors.tests: bg: no job control
./errors.tests: fg: no job control
./errors.tests: kill: -s requires an argument
./errors.tests: kill: bad signal spec `S'
./errors.tests: kill: `': not a pid or valid job spec
./errors.tests: line 225: return: can only `return' from a function or sourced script
./errors.tests: line 229: break: 0: loop count out of range
./errors.tests: line 233: continue: 0: loop count out of range
./errors.tests: line 238: builtin: bash: not a shell builtin
./errors.tests: line 242: bg: no job control
./errors.tests: line 243: fg: no job control
./errors.tests: line 246: kill: -s: option requires an argument
./errors.tests: line 248: kill: S: invalid signal specification
./errors.tests: line 250: kill: `': not a pid or valid job spec
kill: usage: kill [-s sigspec | -n signum | -sigspec] [pid | job]... or kill -l [sigspec]
./errors.tests: set: trackall: unknown option name
./errors.tests: `!!': not a valid identifier
./errors.tests: line 255: set: trackall: invalid option name
./errors.tests: line 262: `!!': not a valid identifier
+9 -9
View File
@@ -4,36 +4,36 @@ aa bb cc dd ee
after exec1.sub with args: 0
after exec1.sub without args: 0
./execscript: notthere: command not found
./execscript: line 20: notthere: command not found
127
notthere: notthere: No such file or directory
127
/bin/sh: /bin/sh: cannot execute binary file
126
./execscript: /: is a directory
./execscript: line 32: /: is a directory
126
/: /: cannot execute binary file
126
./execscript: .: /: is a directory
./execscript: line 39: .: /: is a directory
1
127
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
./exec3.sub: line 3: /tmp/bash-notthere: No such file or directory
./exec3.sub: line 3: exec: /tmp/bash-notthere: cannot execute: No such file or directory
126
./execscript: notthere: No such file or directory
./execscript: line 61: notthere: No such file or directory
127
./execscript: notthere: No such file or directory
./execscript: line 64: notthere: No such file or directory
127
./execscript: notthere: No such file or directory
./execscript: line 67: notthere: No such file or directory
127
this is sh
this is sh
unset
ok
5
./exec5.sub: exec: bash-notthere: not found
./exec5.sub: line 4: exec: bash-notthere: not found
127
this is ohio-state
0
+2 -2
View File
@@ -2,7 +2,7 @@ getopts: usage: getopts optstring name [arg]
2
getopts: usage: getopts optstring name [arg]
2
./getopts.tests: getopts: illegal option: -a
./getopts.tests: line 10: getopts: -a: invalid option
getopts: usage: getopts optstring name [arg]
-a specified
-b bval specified
@@ -52,5 +52,5 @@ remaining args:
-a specified
remaining args:
0
./getopts7.sub: getopts: `opt-var': not a valid identifier
./getopts7.sub: line 4: getopts: `opt-var': not a valid identifier
remaining args:
+3 -4
View File
@@ -369,11 +369,10 @@ GLOBIGNORE=
expect '<man/man1/bash.1>'
recho */man*/bash.*
builtin cd /
rm -rf $TESTDIR
# this is for the benefit of pure coverage, so it writes the pcv file
# in the right place
# in the right place, and for gprof
builtin cd $MYDIR
rm -rf $TESTDIR
exit 0
+26
View File
@@ -0,0 +1,26 @@
abcde
yo
hot damn
what a fabulous window treatment
double"quote
onetwothree
first second third
f1 ()
{
cat <<< "abcde";
cat <<< "yo";
cat <<< "$a $b";
cat <<< 'what a fabulous window treatment';
cat <<< 'double"quote'
}
f2 ()
{
cat <<< onetwothree
}
f3 ()
{
cat <<< "$@"
}
echo $(echo hi)
echo ho
echo off to work we go
+36
View File
@@ -0,0 +1,36 @@
a=hot
b=damn
f1()
{
cat <<< "abcde"
cat <<< "yo"
cat <<< "$a $b"
cat <<< 'what a fabulous window treatment'
cat <<< 'double"quote'
}
f2()
{
cat <<< onetwothree
}
f3()
{
cat <<< "$@"
}
f1
f2
f3 first second third
typeset -f
cat <<< 'echo $(echo hi)'
cat <<< "echo ho"
cat <<< "echo $(echo off to work we go)"
+1 -1
View File
@@ -1,5 +1,5 @@
echo $BASH_VERSION
./histexp.tests: history: !!:z: history expansion failed
./histexp.tests: line 22: history: !!:z: history expansion failed
1 for i in one two three; do echo $i; done
2 /bin/sh -c 'echo this is $0'
3 ls
+5 -6
View File
@@ -1,7 +1,7 @@
./history.tests: history: illegal option: -x
./history.tests: line 4: history: -x: invalid option
history: usage: history [-c] [-d offset] [n] or history -awrn [filename] or history -ps arg [arg...]
./history.tests: history: cannot use more than one of -anrw
./history.tests: fc: illegal option: -v
./history.tests: line 6: history: cannot use more than one of -anrw
./history.tests: line 9: fc: -v: invalid option
fc: usage: fc [-e ename] [-nlr] [first] [last] or fc -s [pat=rep] [cmd]
1 for i in one two three; do echo $i; done
2 /bin/sh -c 'echo this is $0'
@@ -97,8 +97,7 @@ line 2 for history
6 HISTFILE=/tmp/newhistory
7 echo displaying \$HISTFILE after history -a
8 cat $HISTFILE
./history.tests: fc: history specification out of range
./history.tests: fc: history specification out of range
./history.tests: line 73: fc: history specification out of range
14 set -H
15 echo line 2 for history
16 unset HISTSIZE
@@ -108,5 +107,5 @@ echo xx xb xc
xx xb xc
echo 44 48 4c
44 48 4c
./history.tests: fc: no command found
./history.tests: line 88: fc: no command found
1
-1
View File
@@ -70,7 +70,6 @@ unset HISTFILE
fc -l 4
fc -l 4 8
fc -l 502
fc -l one=two three=four 502
history 4
-1
View File
@@ -1 +0,0 @@
a:b:c
-5
View File
@@ -1,5 +0,0 @@
OIFS="$IFS"
IFS=":$IFS"
eval foo="a:b:c"
IFS="$OIFS"
echo $foo
-1
View File
@@ -1 +0,0 @@
a:b:c
-9
View File
@@ -1,9 +0,0 @@
OIFS=$IFS
IFS=":$IFS"
foo=$(echo a:b:c)
IFS=$OIFS
for i in $foo
do
echo $i
done
-1
View File
@@ -1 +0,0 @@
a:b:c
-9
View File
@@ -1,9 +0,0 @@
OIFS=$IFS
IFS=":$IFS"
foo=`echo a:b:c`
IFS=$OIFS
for i in $foo
do
echo $i
done
+10
View File
@@ -0,0 +1,10 @@
a:b:c
a:b:c
a:b:c
a b c d e
a:b:c:d:e
a b c d e
a:b:c:d:e
a:b:c:d:e
a b c d e
a b c d e
+61
View File
@@ -0,0 +1,61 @@
OIFS="$IFS"
IFS=":$IFS"
eval foo="a:b:c"
IFS="$OIFS"
echo $foo
OIFS=$IFS
IFS=":$IFS"
foo=$(echo a:b:c)
IFS=$OIFS
for i in $foo
do
echo $i
done
OIFS=$IFS
IFS=":$IFS"
foo=`echo a:b:c`
IFS=$OIFS
for i in $foo
do
echo $i
done
DEFIFS=$' \t\n'
# local copy of IFS that shadows global version
function f
{
typeset IFS=:
echo $1
}
function ff
{
echo $1
}
f a:b:c:d:e
x=a:b:c:d:e
echo $x
IFS=: ff a:b:c:d:e
echo $x
# doesn't get word split
IFS=$DEFIFS
# variable assignment doesn't use new value for word splitting
IFS=: echo $x
# but does this time because of the eval
IFS=: eval echo \$x
# in posix mode, assignments preceding special builtins and functions are global
set -o posix
IFS=: export x
echo $x
IFS="$DEFIFS"
+16 -16
View File
@@ -1,4 +1,4 @@
./jobs2.sub: fg: job %1 started without job control
./jobs2.sub: line 9: fg: job %1 started without job control
fg: 1
Waiting for job 0
job 0 returns 0
@@ -17,19 +17,19 @@ job 6 returns 0
Waiting for job 7
job 7 returns 0
0
./jobs.tests: wait: job control not enabled
./jobs.tests: fg: no job control
./jobs.tests: line 15: wait: no job control
./jobs.tests: line 20: fg: no job control
wait-for-pid
wait-errors
./jobs.tests: wait: `1-1' is not a pid or valid job spec
./jobs.tests: wait: `-4' is not a pid or valid job spec
./jobs.tests: line 33: wait: `1-1': not a pid or valid job spec
./jobs.tests: line 34: wait: `-4': not a pid or valid job spec
wait-for-background-pids
async list wait-for-background-pids
async list wait for child
forked
wait-when-no-children
wait-for-job
./jobs.tests: wait: %2: no such job
./jobs.tests: line 56: wait: %2: no such job
127
async list wait-for-job
forked
@@ -42,19 +42,19 @@ sleep 5
fg-bg 4
sleep 5
fg-bg 5
./jobs.tests: fg: %2: no such job
./jobs.tests: bg: bg background job?
./jobs.tests: line 83: fg: %2: no such job
./jobs.tests: line 84: bg: bg background job?
fg-bg 6
./jobs.tests: fg: illegal option: -s
./jobs.tests: line 91: fg: -s: invalid option
fg: usage: fg [job_spec]
./jobs.tests: bg: illegal option: -s
./jobs.tests: line 92: bg: -s: invalid option
bg: usage: bg [job_spec]
./jobs.tests: disown: illegal option: -s
./jobs.tests: line 97: disown: -s: invalid option
disown: usage: disown [-h] [-ar] [jobspec ...]
./jobs.tests: disown: %1: no such job
./jobs.tests: disown: %2: no such job
./jobs.tests: line 101: disown: %1: no such job
./jobs.tests: line 104: disown: %2: no such job
wait-for-non-child
./jobs.tests: wait: pid 1 is not a child of this shell
./jobs.tests: line 107: wait: pid 1 is not a child of this shell
127
3 -- 1 2 3 -- 1 - 2 - 3
[1] Running sleep 300 &
@@ -64,8 +64,8 @@ running jobs:
[1] Running sleep 300 &
[2]- Running sleep 350 &
[3]+ Running sleep 400 &
./jobs.tests: kill: %4: no such job
./jobs.tests: jobs: no such job %4
./jobs.tests: line 123: kill: %4: no such job
./jobs.tests: line 125: jobs: %4: no such job
current job:
[3]+ Running sleep 400 &
previous job:
+10 -10
View File
@@ -41,8 +41,8 @@ argv[1] = <\ $HOME>
argv[1] = <\ \ $HOME>
argv[1] = <'bar'>
argv[1] = <'bar'>
argv[1] = <*@*>
argv[1] = <*@*>
argv[1] = <*@>
argv[1] = <*@>
argv[1] = <*@>
argv[1] = <*@>
argv[1] = <*@*>
@@ -108,7 +108,7 @@ argv[3] = <c>
argv[4] = <d>
argv[5] = <e>
argv[6] = <f>
./more-exp.tests: abc=def: command not found
./more-exp.tests: line 269: abc=def: command not found
argv[1] = <a b c d e>
argv[1] = <a>
argv[2] = <b>
@@ -184,13 +184,13 @@ argv[1] = <1>
argv[1] = <5>
argv[1] = <5>
argv[1] = <0>
./more-exp.tests: ${#:}: bad substitution
./more-exp.tests: ${#/}: bad substitution
./more-exp.tests: ${#%}: bad substitution
./more-exp.tests: ${#=}: bad substitution
./more-exp.tests: ${#+}: bad substitution
./more-exp.tests: ${#1xyz}: bad substitution
./more-exp.tests: #: %: syntax error: operand expected (error token is "%")
./more-exp.tests: line 420: ${#:}: bad substitution
./more-exp.tests: line 422: ${#/}: bad substitution
./more-exp.tests: line 424: ${#%}: bad substitution
./more-exp.tests: line 426: ${#=}: bad substitution
./more-exp.tests: line 428: ${#+}: bad substitution
./more-exp.tests: line 430: ${#1xyz}: bad substitution
./more-exp.tests: line 433: #: %: syntax error: operand expected (error token is "%")
argv[1] = <0>
argv[1] = <a+b>
argv[1] = <+>
+2 -2
View File
@@ -96,9 +96,9 @@ expect "<'bar'>"
recho "${fox='$foo'}"
P='*@*'
expect '<*@*>'
expect '<*@>'
recho "${P%"*"}"
expect '<*@*>'
expect '<*@>'
recho "${P%'*'}"
expect '<*@>'
+53 -22
View File
@@ -3,7 +3,7 @@ argv[1] = <foo>
argv[1] = </usr/homes/chet>
argv[1] = </usr/homes/chet>
argv[1] = </usr/homes/chet>
./new-exp.tests: HOME: }: syntax error: operand expected (error token is "}")
./new-exp.tests: line 24: HOME: }: syntax error: operand expected (error token is "}")
unset
argv[1] = </usr/homes/chet>
argv[1] = </usr/homes/chet>
@@ -12,8 +12,8 @@ argv[1] = </usr/homes/chet>
argv[1] = </usr/homes/chet>
argv[1] = </usr/homes/chet>
argv[1] = </usr/homes/chet>
argv[1] = <*@*>
argv[1] = <*@*>
argv[1] = <*@>
argv[1] = <*@>
argv[1] = <@*>
argv[1] = <)>
argv[1] = <")">
@@ -59,8 +59,8 @@ argv[1] = <4>
argv[1] = <op>
argv[1] = <abcdefghijklmnop>
argv[1] = <abcdefghijklmnop>
./new-exp.tests: ABX: unbound variable
./new-exp.tests: $6: cannot assign in this way
./new-exp.tests: line 172: ABX: unbound variable
./new-exp.tests: line 176: $6: cannot assign in this way
argv[1] = <xxcde>
argv[1] = <axxde>
argv[1] = <abxyz>
@@ -162,11 +162,11 @@ lines.
This-string-has-multiple-lines.
this is a test of proc subst
this is test 2
./new-exp2.sub: /tmp/bashtmp.x*: No such file or directory
./new-exp2.sub: /tmp/redir-notthere: No such file or directory
./new-exp2.sub: line 31: /tmp/bashtmp.x*: No such file or directory
./new-exp2.sub: line 35: /tmp/redir-notthere: No such file or directory
1
argv[1] = <6>
./new-exp.tests: ${#:}: bad substitution
./new-exp.tests: line 277: ${#:}: bad substitution
argv[1] = <'>
argv[1] = <">
argv[1] = <"hello">
@@ -233,7 +233,7 @@ argv[1] = <oneonetwo>
argv[1] = <onetwo>
argv[1] = <two>
argv[1] = <oneonetwo>
./new-exp.tests: -2: substring expression < 0
./new-exp.tests: line 421: -2: substring expression < 0
argv[1] = <defghi>
argv[1] = <efghi>
argv[1] = <e*docrine>
@@ -395,13 +395,13 @@ argv[6] = <w>
argv[7] = <x>
argv[8] = <y>
argv[9] = <z>
./new-exp.tests: $9: unbound variable
./new-exp.tests: 9: unbound variable
./new-exp.tests: UNSET: unbound variable
./new-exp.tests: UNSET: unbound variable
./new-exp.tests: UNSET: unbound variable
./new-exp.tests: UNSET: unbound variable
./new-exp.tests: UNSET: unbound variable
./new-exp.tests: line 480: $9: unbound variable
./new-exp.tests: line 481: 9: unbound variable
./new-exp.tests: line 482: UNSET: unbound variable
./new-exp.tests: line 483: UNSET: unbound variable
./new-exp.tests: line 484: UNSET: unbound variable
./new-exp.tests: line 485: UNSET: unbound variable
./new-exp.tests: line 486: UNSET: unbound variable
argv[1] = <5>
argv[1] = <#>
argv[1] = <#>
@@ -419,10 +419,10 @@ argv[4] = <_QUILL>
argv[5] = <_QUOTA>
argv[6] = <_QUOTE>
argv[1] = <_QUANTITY-_QUART-_QUEST-_QUILL-_QUOTA-_QUOTE>
./new-exp3.sub: ${!_Q* }: bad substitution
./new-exp3.sub: ${!1*}: bad substitution
./new-exp3.sub: ${!@*}: bad substitution
./new-exp.tests: ${$(($#-1))}: bad substitution
./new-exp3.sub: line 19: ${!_Q* }: bad substitution
./new-exp3.sub: line 24: ${!1*}: bad substitution
./new-exp3.sub: line 26: ${!@*}: bad substitution
./new-exp.tests: line 503: ${$(($#-1))}: bad substitution
argv[1] = <a>
argv[2] = <b>
argv[3] = <c>
@@ -439,5 +439,36 @@ argv[1] = <a>
argv[1] = <a>
argv[2] = <b>
argv[1] = <>
./new-exp.tests: $(($# - 2)): substring expression < 0
./new-exp.tests: ABXD: parameter unset
./new-exp.tests: line 522: $(($# - 2)): substring expression < 0
argv[1] = <bin>
argv[2] = <bin>
argv[3] = <ucb>
argv[4] = <bin>
argv[5] = <.>
argv[6] = <sbin>
argv[7] = <sbin>
argv[1] = </>
argv[2] = </>
argv[3] = </>
argv[4] = </>
argv[5] = </>
argv[6] = </>
argv[1] = <bin>
argv[2] = <usr/bin>
argv[3] = <usr/ucb>
argv[4] = <usr/local/bin>
argv[5] = <.>
argv[6] = <sbin>
argv[7] = <usr/sbin>
argv[1] = </bin>
argv[2] = </usr/bin>
argv[3] = </usr/ucb>
argv[4] = </usr/local/bin>
argv[5] = <.>
argv[6] = </sbin>
argv[7] = </usr/sbin>
argv[1] = </full/path/to>
argv[1] = </>
argv[1] = <full/path/to/x16>
argv[1] = <x16>
./new-exp.tests: line 542: ABXD: parameter unset
+18 -2
View File
@@ -44,9 +44,9 @@ expect "<$HOME>"
recho "$(echo "$(echo "${HOME}")")"
P=*@*
expect '<*@*>'
expect '<*@>'
recho "${P%"*"}" #
expect '<*@*>'
expect '<*@>'
recho "${P%'*'}" #
expect '<@*>'
recho "${P#\*}" # should be @*
@@ -521,6 +521,22 @@ recho "${*:1:0}"
set a
recho ${@:1:$(($# - 2))}
XPATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:.:/sbin:/usr/sbin
set $( IFS=: ; echo $XPATH )
recho ${@##*/}
recho ${@%%[!/]*}
recho ${@#/*}
recho ${@%*/}
set /full/path/to/x16 /another/full/path
recho ${1%/*}
recho ${1%%[!/]*}
recho ${1#*/}
recho ${1##*/}
# this must be last!
expect $0: 'ABXD: parameter unset'
recho ${ABXD:?"parameter unset"}
+121
View File
@@ -0,0 +1,121 @@
argv[1] = <a>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <1>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <b>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <c>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <d>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <a>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <1>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <b>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <c>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <d>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <a>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <1>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <b>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <c>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <d>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <a>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <1>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <b>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <c>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <d>
argv[2] = <a^Ab>
argv[3] = <3>
argv[1] = <e1>
argv[2] = <v^A^A>
argv[1] = <e2>
argv[2] = <v^A^A>
argv[1] = <e3>
argv[2] = <v^A^A>
argv[1] = <e4>
argv[2] = <v^A^A>
argv[1] = <a1>
argv[2] = <uv^A^A>
argv[1] = <a2>
argv[2] = <uv^A^A>
argv[1] = <a3>
argv[2] = <uv^A^Awx>
argv[3] = <uv^A^Awx>
argv[1] = <a4>
argv[2] = <uv^A^Awx>
argv[3] = <uv^A^Awx>
argv[1] = <p1>
argv[2] = <uv^A^Awx>
argv[3] = <uv^A^Awx>
argv[1] = <p2>
argv[2] = <uv^A^Awx>
argv[3] = <uv^A^Awx>
argv[1] = <p1>
argv[2] = <uv^A^Awx>
argv[3] = <uv^A^Awx>
argv[1] = <p2>
argv[2] = <uv^A^Awx uv^A^Awx>
argv[1] = <uv^A^Awx>
argv[1] = <uv^A^Awx>
argv[1] = <uv^A^Awx>
^A
^A
^B
argv[1] = <f1>
argv[2] = <v^Aw>
argv[1] = <f2>
argv[2] = <v^Aw>
argv[1] = <a1>
argv[2] = <uv^Aw>
argv[1] = <a2>
argv[2] = <uv^Aw>
argv[1] = <a3>
argv[2] = <uv^Aw>
argv[1] = <a4>
argv[2] = <uv^Aw>
argv[1] = <e1>
argv[2] = <uv^Aw>
argv[1] = <e2>
argv[2] = <uv^Aw>
argv[1] = <d1>
argv[2] = <^Aw>
argv[1] = <d2>
argv[2] = <^Aw>
argv[1] = <@1>
argv[2] = <uv^Aw^Axy>
argv[3] = <uv^Aw^Axy>
argv[1] = <@2>
argv[2] = <uv^Aw^Axy>
argv[3] = <uv^Aw^Axy>
+97
View File
@@ -0,0 +1,97 @@
a=$'a\001b'
set $a
b=$a
c=$1
d="$1"
e=$'uv\001\001wx'
recho a $a ${#a}
recho 1 $1 ${#1}
recho b $b ${#b}
recho c $c ${#c}
recho d $d ${#d}
recho a ${a} ${#a}
recho 1 ${1} ${#1}
recho b ${b} ${#b}
recho c ${c} ${#c}
recho d ${d} ${#d}
recho a "$a" ${#a}
recho 1 "$1" ${#1}
recho b "$b" ${#b}
recho c "$c" ${#c}
recho d "$d" ${#d}
recho a "${a}" ${#a}
recho 1 "${1}" ${#1}
recho b "${b}" ${#b}
recho c "${c}" ${#c}
recho d "${d}" ${#d}
set $e
recho e1 ${e:1:3}
recho e2 "${e:1:3}"
recho e3 ${1:1:3}
recho e4 "${1:1:3}"
arr[0]=$e
arr[1]=$e
recho a1 ${arr:0:4}
recho a2 "${arr:0:4}"
recho a3 ${arr[@]:0:2}
recho a4 "${arr[@]:0:2}"
set $e $e
recho p1 ${@:1:2}
recho p2 "${@:1:2}"
recho p1 ${*:1:2}
recho p2 "${*:1:2}"
recho $e
recho 'uvwx'
f='uvwx'
recho $f
echo -en "\01" | cat -v
echo
huhu() { echo "$1"; };
huhu $(echo -en "\01") | cat -v
huhu $(echo -en "\02") | cat -v
f=$'uv\001w\001xy'
set $f $f
recho f1 ${f:1:3}
recho f2 "${f:1:3}"
arr[0]=$f
arr[1]=$f
recho a1 ${arr:0:4}
recho a2 "${arr:0:4}"
recho a3 ${arr[0]:0:4}
recho a4 "${arr[0]:0:4}"
recho e1 ${f:0:4}
recho e2 "${f:0:4}"
recho d1 ${1:2:2}
recho d2 "${1:2:2}"
recho @1 ${@:1:2}
recho @2 "${@:1:2}"
+76
View File
@@ -0,0 +1,76 @@
argv[1] = <a^Ab>
argv[1] = <uv^A^Awx>
argv[1] = <aAb>
argv[1] = <aAb>
argv[1] = <uvA^Awx>
argv[1] = <uvA^Awx>
argv[1] = <a^AB>
argv[1] = <a^AB>
argv[1] = <uv^A^AWx>
argv[1] = <uv^A^AWx>
argv[1] = <aAb>
argv[1] = <aAb>
argv[1] = <uvAAwx>
argv[1] = <uvAAwx>
argv[1] = <a^AB>
argv[1] = <a^AB>
argv[1] = <uv^A^AWx>
argv[1] = <uv^A^AWx>
argv[1] = <uvA^Awx>
argv[2] = <uvA^Awx>
argv[1] = <uvA^Awx>
argv[2] = <uvA^Awx>
argv[1] = <uv^A^AWx>
argv[2] = <uv^A^AWx>
argv[1] = <uv^A^AWx>
argv[2] = <uv^A^AWx>
argv[1] = <uvAAwx>
argv[2] = <uvAAwx>
argv[1] = <uvAAwx>
argv[2] = <uvAAwx>
argv[1] = <uv^A^AWx>
argv[2] = <uv^A^AWx>
argv[1] = <uv^A^AWx>
argv[2] = <uv^A^AWx>
argv[1] = <a^Ab>
argv[1] = <uv^A^Awx>
argv[1] = <aAb>
argv[1] = <aAb>
argv[1] = <uvA^Awx>
argv[1] = <uvA^Awx>
argv[1] = <a^AB>
argv[1] = <a^AB>
argv[1] = <uv^A^AWx>
argv[1] = <uv^A^AWx>
argv[1] = <aAb>
argv[1] = <aAb>
argv[1] = <uvAAwx>
argv[1] = <uvAAwx>
argv[1] = <a^AB>
argv[1] = <a^AB>
argv[1] = <uv^A^AWx>
argv[1] = <uv^A^AWx>
argv[1] = <aAb>
argv[2] = <uvA^Awx>
argv[1] = <aAb>
argv[2] = <uvA^Awx>
argv[1] = <a^AB>
argv[2] = <uv^A^Awx>
argv[1] = <a^AB>
argv[2] = <uv^A^Awx>
argv[1] = <a^Ab>
argv[2] = <uv^A^AWx>
argv[1] = <a^Ab>
argv[2] = <uv^A^AWx>
argv[1] = <aAb>
argv[2] = <uvAAwx>
argv[1] = <aAb>
argv[2] = <uvAAwx>
argv[1] = <a^AB>
argv[2] = <uv^A^Awx>
argv[1] = <a^AB>
argv[2] = <uv^A^Awx>
argv[1] = <a^Ab>
argv[2] = <uv^A^AWx>
argv[1] = <a^Ab>
argv[2] = <uv^A^AWx>
+82
View File
@@ -0,0 +1,82 @@
a=$'a\001b'
e=$'uv\001\001wx'
recho $a
recho $e
recho ${a/$'\001'/A}
recho "${a/$'\001'/A}"
recho ${e/$'\001'/A}
recho "${e/$'\001'/A}"
recho ${a/b/B}
recho "${a/b/B}"
recho ${e/w/W}
recho "${e/w/W}"
recho ${a//$'\001'/A}
recho "${a//$'\001'/A}"
recho ${e//$'\001'/A}
recho "${e//$'\001'/A}"
recho ${a//b/B}
recho "${a//b/B}"
recho ${e//w/W}
recho "${e//w/W}"
# pos params pat subst
set $e $e
recho ${@/$'\001'/A}
recho "${@/$'\001'/A}"
recho ${@/w/W}
recho "${@/w/W}"
recho ${@//$'\001'/A}
recho "${@//$'\001'/A}"
recho ${@//w/W}
recho "${@//w/W}"
arr[0]=$a
arr[1]=$e
recho ${arr[0]}
recho ${arr[1]}
recho ${arr[0]/$'\001'/A}
recho "${arr[0]/$'\001'/A}"
recho ${arr[1]/$'\001'/A}
recho "${arr[1]/$'\001'/A}"
recho ${arr[0]/b/B}
recho "${arr[0]/b/B}"
recho ${arr[1]/w/W}
recho "${arr[1]/w/W}"
recho ${arr[0]//$'\001'/A}
recho "${arr[0]//$'\001'/A}"
recho ${arr[1]//$'\001'/A}
recho "${arr[1]//$'\001'/A}"
recho ${arr[0]//b/B}
recho "${arr[0]//b/B}"
recho ${arr[1]//w/W}
recho "${arr[1]//w/W}"
recho ${arr[@]/$'\001'/A}
recho "${arr[@]/$'\001'/A}"
recho ${arr[@]/b/B}
recho "${arr[@]/b/B}"
recho ${arr[@]/w/W}
recho "${arr[@]/w/W}"
recho ${arr[@]//$'\001'/A}
recho "${arr[@]//$'\001'/A}"
recho ${arr[@]//b/B}
recho "${arr[@]//b/B}"
recho ${arr[@]//w/W}
recho "${arr[@]//w/W}"
+60
View File
@@ -0,0 +1,60 @@
argv[1] = <uv^A^A>
argv[1] = <uv^A^A>
argv[1] = <uv^A>
argv[1] = <uv^A>
argv[1] = <^Ab>
argv[1] = <^Ab>
argv[1] = <xy>
argv[1] = <xy>
argv[1] = <xy>
argv[1] = <uv^Aw^Axy>
argv[1] = <uv^A>
argv[1] = <uv^A>
argv[1] = <^Awx>
argv[1] = <^Awx>
argv[1] = <xy>
argv[1] = <xy>
argv[1] = <xy>
argv[1] = <uv^Aw^Axy>
argv[1] = <uv^A>
argv[1] = <uv^A>
argv[1] = <^Awx>
argv[1] = <^Awx>
argv[1] = <uv^A>
argv[1] = <uv^A>
argv[1] = <^Awx>
argv[1] = <^Awx>
argv[1] = <xy>
argv[1] = <xy>
argv[1] = <xy>
argv[1] = <xy>
argv[1] = <uv^Aw^Axy>
argv[1] = <uv^Aw^Axy>
argv[1] = <uv^A>
argv[1] = <uv^A>
argv[1] = <^Awx>
argv[1] = <^Awx>
argv[1] = <uv^A>
argv[2] = <uv^Aw>
argv[1] = <uv^A>
argv[2] = <uv^Aw>
argv[1] = <^Awx>
argv[2] = <w^Axy>
argv[1] = <^Awx>
argv[2] = <w^Axy>
argv[1] = <wx>
argv[2] = <xy>
argv[1] = <uv^A^Awx>
argv[2] = <uv^Aw^Axy>
argv[1] = <uv^A>
argv[2] = <uv^Aw>
argv[1] = <uv^A>
argv[2] = <uv^Aw>
argv[1] = <^Awx>
argv[2] = <w^Axy>
argv[1] = <^Awx>
argv[2] = <w^Axy>
argv[1] = <wx>
argv[2] = <xy>
argv[1] = <uv^A^Awx>
argv[2] = <uv^Aw^Axy>
+85
View File
@@ -0,0 +1,85 @@
a=$'a\001b'
set $a
b=$a
c=$1
d="$1"
e=$'uv\001\001wx'
f=$'uv\001w\001xy'
set $e $e
recho ${e%%??}
recho "${e%%??}"
recho ${e%%???}
recho "${e%%???}"
recho ${a#?}
recho "${a#?}"
# simple variables
recho ${f##*$'\001'}
recho "${f##*$'\001'}"
recho ${f##*''} # literal ^A
recho "${f##*'^A'}" # two characters, `^' and `A'
recho ${e%$'\001'*}
recho "${e%$'\001'*}"
recho ${e#*$'\001'}
recho "${e#*$'\001'}"
# array members
arr[0]=$e
arr[1]=$f
recho ${arr[1]##*$'\001'}
recho "${arr[1]##*$'\001'}"
recho ${arr[1]##*''} # literal ^A
recho "${arr[1]##*'^A'}" # two characters, `^' and `A'
recho ${arr[0]%$'\001'*}
recho "${arr[0]%$'\001'*}"
recho ${arr[0]#*$'\001'}
recho "${arr[0]#*$'\001'}"
recho ${arr%$'\001'*}
recho "${arr%$'\001'*}"
recho ${arr#*$'\001'}
recho "${arr#*$'\001'}"
# positional parameters
set $e $f
recho ${2##*$'\001'}
recho "${2##*$'\001'}"
recho ${2##*''} # literal ^A
recho "${2##*''}" # literal ^A
recho ${2##*'^A'} # two characters, `^' and `A'
recho "${2##*'^A'}" # two characters, `^' and `A'
recho ${1%$'\001'*}
recho "${1%$'\001'*}"
recho ${1#*$'\001'}
recho "${1#*$'\001'}"
recho ${@%$'\001'*}
recho "${@%$'\001'*}"
recho ${@#*$'\001'}
recho "${@#*$'\001'}"
recho ${@##*''} # literal ^A
recho "${@##*'^A'}" # two characters, `^' and `A'
# arrays treated as a whole
recho ${arr[@]%$'\001'*}
recho "${arr[@]%$'\001'*}"
recho ${arr[@]#*$'\001'}
recho "${arr[@]#*$'\001'}"
recho ${arr[@]##*''} # literal ^A
recho "${arr[@]##*'^A'}" # two characters, `^' and `A'
Binary file not shown.
+6 -2
View File
@@ -37,11 +37,15 @@ a = abc
4
1
4
./read2.sub: read: -3: invalid timeout specification
./read2.sub: line 13: read: -3: invalid timeout specification
1
4
abcde
./read3.sub: read: -1: invalid number specification
./read3.sub: line 4: read: -1: invalid number
abc
ab
#
while read -u 3 var
do
echo "$var"
done 3<$0
+3
View File
@@ -87,3 +87,6 @@ ${THIS_SH} ./read2.sub
# test read -n nchars behavior
${THIS_SH} ./read3.sub
# test read -u fd behavior
${THIS_SH} ./read4.sub
+4
View File
@@ -0,0 +1,4 @@
while read -u 3 var
do
echo "$var"
done 3<$0
+48 -5
View File
@@ -1,9 +1,9 @@
abc
./redir.tests: /tmp/redir-test: cannot overwrite existing file
./redir.tests: line 13: /tmp/redir-test: cannot overwrite existing file
abc
def
def
./redir.tests: $z: ambiguous redirect
./redir.tests: line 29: $z: ambiguous redirect
Point 1
Point 2
to a
@@ -24,8 +24,8 @@ read line3 "cd"
read line4 "daemon"
from stdin: aa
to stdout
./redir4.sub: $fd: ambiguous redirect
./redir4.sub: $fd: ambiguous redirect
./redir4.sub: line 32: $fd: ambiguous redirect
./redir4.sub: line 33: $fd: ambiguous redirect
/tmp/err-and-out:
to stdout
to stderr
@@ -44,4 +44,47 @@ kl
ab
cd
cd
./redir.tests: redir1.*: No such file or directory
./redir.tests: line 152: redir1.*: No such file or directory
# tests of ksh93-like dup-and-close redirection operators
exec 9<$0
f()
{
exec 5<$0
exec 0<&5-
while read line; do
echo "$line"
done
}
f
typeset -f f
# make sure it was closed
read -u 5 foo
echo after read
exec 5<&0
exec <&-
read abcde
exec 0<&9-
read line
echo $line
f ()
{
exec 5<$0;
exec 0<&5-;
while read line; do
echo "$line";
done
}
./redir5.sub: line 20: read: 5: invalid file descriptor: Bad file descriptor
after read
./redir5.sub: line 27: read: read error: 0: Bad file descriptor
# tests of ksh93-like dup-and-close redirection operators
+3
View File
@@ -150,3 +150,6 @@ echo $l2
# a single filename
set -o posix
cat < redir1.*
# test ksh93 dup-and-close (move fd) redirections
${THIS_SH} ./redir5.sub
+31
View File
@@ -0,0 +1,31 @@
# tests of ksh93-like dup-and-close redirection operators
exec 9<$0
f()
{
exec 5<$0
exec 0<&5-
while read line; do
echo "$line"
done
}
f
typeset -f f
# make sure it was closed
read -u 5 foo
echo after read
exec 5<&0
exec <&-
read abcde
exec 0<&9-
read line
echo $line
+11 -11
View File
@@ -1,13 +1,13 @@
./rsh.tests: cd: restricted
./rsh.tests: PATH: readonly variable
./rsh.tests: SHELL: readonly variable
./rsh.tests: /bin/sh: restricted: cannot specify `/' in command names
./rsh.tests: .: ./source.sub3: restricted
./rsh.tests: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: command: restricted: cannot use -p
./rsh.tests: set: unknown option: +r
./rsh.tests: line 9: cd: restricted
./rsh.tests: line 10: PATH: readonly variable
./rsh.tests: line 11: SHELL: readonly variable
./rsh.tests: line 12: /bin/sh: restricted: cannot specify `/' in command names
./rsh.tests: line 14: .: ./source.sub3: restricted
./rsh.tests: line 17: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 21: /tmp/restricted: restricted: cannot redirect output
./rsh.tests: line 26: command: -p: restricted
./rsh.tests: line 28: set: +r: invalid option
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
./rsh.tests: set: restricted: unknown option name
./rsh.tests: exec: restricted
./rsh.tests: line 29: set: restricted: invalid option name
./rsh.tests: line 31: exec: restricted
./rsh.tests: after exec
+2
View File
@@ -0,0 +1,2 @@
${THIS_SH} ./herestr.tests > /tmp/xx 2>&1
diff /tmp/xx herestr.right && rm -f /tmp/xx
+2
View File
@@ -0,0 +1,2 @@
${THIS_SH} ./ifs.tests > /tmp/xx 2>&1
diff /tmp/xx ifs.right && rm -f /tmp/xx
-13
View File
@@ -1,13 +0,0 @@
#
# show that IFS is only applied to the result of expansions
#
${THIS_SH} ifs-1.test > /tmp/xx
diff /tmp/xx ./ifs-1.right
${THIS_SH} ifs-2.test > /tmp/xx
diff /tmp/xx ./ifs-2.right
${THIS_SH} ifs-3.test > /tmp/xx
diff /tmp/xx ./ifs-3.right
rm -f /tmp/xx
+4
View File
@@ -0,0 +1,4 @@
echo "warning: several of these tests will fail if arrays have not" >&2
echo "warning: been compiled into the shell." >&2
${THIS_SH} ./nquote1.tests 2>&1 | grep -v '^expect' > /tmp/xx
diff /tmp/xx nquote1.right && rm -f /tmp/xx
+4
View File
@@ -0,0 +1,4 @@
echo "warning: several of these tests will fail if arrays have not" >&2
echo "warning: been compiled into the shell." >&2
${THIS_SH} ./nquote2.tests 2>&1 | grep -v '^expect' > /tmp/xx
diff /tmp/xx nquote2.right && rm -f /tmp/xx
+4
View File
@@ -0,0 +1,4 @@
echo "warning: several of these tests will fail if arrays have not" >&2
echo "warning: been compiled into the shell." >&2
${THIS_SH} ./nquote3.tests 2>&1 | grep -v '^expect' > /tmp/xx
diff /tmp/xx nquote3.right && rm -f /tmp/xx
+2 -1
View File
@@ -1,6 +1,7 @@
echo "warning: the text of a system error message may vary between systems and" >&2
echo "warning: produce diff output." >&2
echo "warning: if the text of an error message concerning \`redir1.*' not being" >&2
echo "warning: found produces diff output, please do not consider it a test failure" >&2
echo "warning: found or messages concerning bad file descriptors produce diff" >&2
echo "warning: output, please do not consider it a test failure" >&2
${THIS_SH} ./redir.tests > /tmp/xx 2>&1
diff /tmp/xx redir.right && rm -f /tmp/xx
+35 -35
View File
@@ -1,4 +1,4 @@
./shopt.tests: shopt: illegal option: -z
./shopt.tests: line 2: shopt: -z: invalid option
shopt: usage: shopt [-pqsu] [-o long-option] optname [optname...]
--
shopt -u cdable_vars
@@ -84,124 +84,124 @@ xpg_echo off
--
set +o allexport
set -o braceexpand
set -o emacs
set +o errexit
set -o hashall
set -o histexpand
set -o history
set +o ignoreeof
set -o interactive-comments
set +o keyword
set -o monitor
set +o noclobber
set +o noexec
set +o noglob
set +o nolog
set +o notify
set +o nounset
set +o onecmd
set +o physical
set +o posix
set -o privileged
set +o verbose
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
set +o xtrace
--
allexport off
braceexpand on
emacs on
errexit off
hashall on
histexpand on
history on
ignoreeof off
interactive-comments on
keyword off
monitor on
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
posix off
privileged on
verbose off
xtrace off
history on
ignoreeof off
interactive-comments on
nolog off
posix off
emacs on
vi off
xtrace off
--
set +o allexport
set -o braceexpand
set -o emacs
set +o errexit
set -o hashall
set -o histexpand
set -o history
set +o ignoreeof
set -o interactive-comments
set +o keyword
set -o monitor
set +o noclobber
set +o noexec
set +o noglob
set +o nolog
set +o notify
set +o nounset
set +o onecmd
set +o physical
set +o posix
set -o privileged
set +o verbose
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
set +o xtrace
--
set -o history
set +o verbose
--
set -o braceexpand
set -o emacs
set -o hashall
set -o histexpand
set -o monitor
set -o privileged
set -o history
set -o interactive-comments
set -o emacs
set -o monitor
set -o privileged
--
set +o allexport
set +o errexit
set +o ignoreeof
set +o keyword
set +o noclobber
set +o noexec
set +o noglob
set +o nolog
set +o notify
set +o nounset
set +o onecmd
set +o physical
set +o verbose
set +o xtrace
set +o ignoreeof
set +o nolog
set +o posix
set +o verbose
set +o vi
set +o xtrace
--
allexport off
errexit off
ignoreeof off
keyword off
noclobber off
noexec off
noglob off
nolog off
notify off
nounset off
onecmd off
physical off
verbose off
xtrace off
ignoreeof off
nolog off
posix off
verbose off
vi off
xtrace off
--
./shopt.tests: shopt: xyz1: unknown shell option name
./shopt.tests: shopt: xyz1: unknown option name
./shopt.tests: line 93: shopt: xyz1: invalid shell option name
./shopt.tests: line 94: shopt: xyz1: invalid option name
+17 -17
View File
@@ -227,48 +227,48 @@ t -G /tmp/test.group
t -h /tmp/test.symlink
0
t 4+3 -eq 7
./test.tests: test: 4+3: integer expression expected
./test.tests: line 13: test: 4+3: integer expression expected
2
b 4-5 -eq 7
./test.tests: [: 4+3: integer expression expected
./test.tests: line 7: [: 4+3: integer expression expected
2
t 9 -eq 4+5
./test.tests: test: 4+5: integer expression expected
./test.tests: line 13: test: 4+5: integer expression expected
2
b 9 -eq 4+5
./test.tests: [: 4+5: integer expression expected
./test.tests: line 7: [: 4+5: integer expression expected
2
t A -eq 7
./test.tests: test: A: integer expression expected
./test.tests: line 13: test: A: integer expression expected
2
b A -eq 7
./test.tests: [: A: integer expression expected
./test.tests: line 7: [: A: integer expression expected
2
t 9 -eq B
./test.tests: test: B: integer expression expected
./test.tests: line 13: test: B: integer expression expected
2
b 9 -eq B
./test.tests: [: B: integer expression expected
./test.tests: line 7: [: B: integer expression expected
2
t ( 1 = 2
./test.tests: test: `)' expected
./test.tests: line 13: test: `)' expected
2
b ( 1 = 2
./test.tests: [: `)' expected, found ]
./test.tests: line 7: [: `)' expected, found ]
2
./test.tests: test: a: unary operator expected
./test.tests: line 13: test: a: unary operator expected
2
./test.tests: test: b: binary operator expected
./test.tests: line 13: test: b: binary operator expected
2
./test.tests: test: -A: unary operator expected
./test.tests: line 13: test: -A: unary operator expected
2
./test.tests: test: too many arguments
./test.tests: line 13: test: too many arguments
2
./test.tests: test: too many arguments
./test.tests: line 13: test: too many arguments
2
./test.tests: [: missing `]'
./test.tests: line 406: [: missing `]'
2
./test.tests: test: (: unary operator expected
./test.tests: line 13: test: (: unary operator expected
2
t -t a
1
+18 -11
View File
@@ -5,19 +5,9 @@ trap -- 'echo aborting' SIGINT
trap -- 'echo aborting' SIGQUIT
trap -- 'echo aborting' SIGABRT
trap -- 'echo aborting' SIGTERM
debug line
[20] debug
trap -- 'echo exiting' EXIT
trap -- 'echo aborting' SIGHUP
trap -- 'echo aborting' SIGINT
trap -- 'echo aborting' SIGQUIT
trap -- 'echo aborting' SIGABRT
trap -- 'echo aborting' SIGTERM
trap -- 'echo [$LINENO] debug' DEBUG
debug line
[22] debug
funcdebug line
[2] funcdebug
[24] debug
trap -- 'echo exiting' EXIT
trap -- 'echo aborting' SIGHUP
trap -- 'echo aborting' SIGINT
@@ -25,6 +15,9 @@ trap -- 'echo aborting' SIGQUIT
trap -- 'echo aborting' SIGABRT
trap -- 'echo aborting' SIGTERM
trap -- 'echo [$LINENO] debug' DEBUG
[24] debug
func[16] funcdebug
funcdebug line
[26] debug
trap -- 'echo exiting' EXIT
trap -- 'echo aborting' SIGHUP
@@ -32,6 +25,20 @@ trap -- 'echo aborting' SIGINT
trap -- 'echo aborting' SIGQUIT
trap -- 'echo aborting' SIGABRT
trap -- 'echo aborting' SIGTERM
trap -- 'echo [$LINENO] debug' DEBUG
[28] debug
./trap.tests[33] debug
./trap.tests[34] debug
func2[31] debug
func2debug line
./trap.tests[36] debug
./trap.tests[38] debug
trap -- 'echo exiting' EXIT
trap -- 'echo aborting' SIGHUP
trap -- 'echo aborting' SIGINT
trap -- 'echo aborting' SIGQUIT
trap -- 'echo aborting' SIGABRT
trap -- 'echo aborting' SIGTERM
trap -- '' DEBUG
trap -- 'echo exiting' EXIT
trap -- 'echo aborting' SIGHUP
+11 -2
View File
@@ -12,7 +12,7 @@ trap
func()
{
trap 'echo [$LINENO] funcdebug' DEBUG
trap 'echo ${FUNCNAME:-$0}[$LINENO] funcdebug' DEBUG
echo funcdebug line
}
@@ -25,6 +25,16 @@ func
trap
trap 'echo ${FUNCNAME:-$0}[$LINENO] debug' DEBUG
func2()
{
echo func2debug line
}
declare -ft func2
func2
unset -f func2
trap '' DEBUG
trap
@@ -74,4 +84,3 @@ trap -p SIGCHLD
trap SIGINT QUIT TERM
trap
+7 -7
View File
@@ -1,7 +1,7 @@
./type.tests: type: illegal option: -f
type: usage: type [-apt] name [name ...]
./type.tests: type: notthere: not found
./type.tests: command: notthere: not found
./type.tests: line 9: type: -r: invalid option
type: usage: type [-afptP] name [name ...]
./type.tests: line 12: type: notthere: not found
./type.tests: line 13: command: notthere: not found
function
keyword
alias
@@ -35,12 +35,12 @@ builtin
builtin is a shell builtin
/bin/sh
/bin/sh is /bin/sh
./type.tests: type: func: not found
./type.tests: type: m: not found
./type.tests: line 51: type: func: not found
./type.tests: line 53: type: m: not found
/bin/sh
/tmp/bash
bash is hashed (/tmp/bash)
file
hits command
1 /bin/sh
3 /tmp/bash
1 /bin/sh
+1 -1
View File
@@ -6,7 +6,7 @@ unalias -a
# this should echo nothing
type
# this should be a usage error
type -f ${THIS_SH}
type -r ${THIS_SH}
# these should behave identically
type notthere
+15 -2
View File
@@ -31,10 +31,23 @@ declare -x ivar="42"
hB
braceexpand:hashall:interactive-comments
hPB
braceexpand:hashall:physical:interactive-comments
declare -r SHELLOPTS="braceexpand:hashall:physical:interactive-comments"
braceexpand:hashall:interactive-comments:physical
declare -r SHELLOPTS="braceexpand:hashall:interactive-comments:physical"
abcde
20
30
40
50
|0|10|
10
|0|10|
10
|0|10|
10
|4|
4
|0|11|
after fff3: x=4
|0|12|
|y|
|y|
+3
View File
@@ -198,3 +198,6 @@ printenv FOOFOO
# test out export behavior of variable assignments preceding builtins and
# functions
$THIS_SH ./varenv1.sub
# more tests; bugs in bash up to version 2.05a
$THIS_SH ./varenv2.sub
+44
View File
@@ -0,0 +1,44 @@
fff()
{
typeset i=0 x=10
echo "|$i|$x|"
export x
printenv x
}
fff2()
{
echo "|$x|"
export x
printenv x
}
fff3()
{
typeset i=0 x="${x-10}"
echo "|$i|$x|"
}
fff4()
{
typeset i=0 x
x="${x-10}"
echo "|$i|$x|"
}
fff5()
{
z=y typeset z
echo "|$z|"
}
fff
x=10 fff
x=1 fff
x=4 fff2
x=11 fff3
echo after fff3: x=$x
x=12 fff4
fff5
z=42 fff5