Files
bash/tests/builtins.right
T
2025-07-03 16:15:36 -04:00

507 lines
13 KiB
Plaintext

a
end-1
a
end-2
a:x
end-a
b:x
end-b
c:x
end-c
end-3
a:x
end
a
b
c
end-1
a
b
c
end-2
a:x
a:y
a:z
end-a
b:x
b:y
b:z
end-b
c:x
c:y
c:z
end-c
end-3
a:x
b:x
c:x
end
$BVAR
$BVAR
$BVAR
$BVAR
foo
bar
xxx
0022
u=rwx,g=rx,o=rx
0002
u=rwx,g=rwx,o=rx
umask 0002
umask -S u=rwx,g=rwx,o=rx
u=rwx,g=rwx,o=rwx
enable .
enable :
enable break
enable continue
enable eval
enable exec
enable exit
enable export
enable readonly
enable return
enable set
enable shift
enable source
enable times
enable trap
enable unset
enable .
enable :
enable break
enable continue
enable eval
enable exec
enable exit
enable export
enable readonly
enable return
enable set
enable shift
enable source
enable times
enable trap
enable unset
enable -n test worked
enable -n test
enable test worked
./builtins.tests: line 126: enable: notbuiltin: not a shell builtin
./builtins.tests: line 127: enable: test: not dynamically loaded
specialname
-specialname
FOO=BAR
FOO=BAR
hash: hash table empty
0
no-newline
AVAR
foo
in source.sub2, calling return
5
a b c
a b c
x y z
a b c
a b c
m n o p
a b c
m n o p
/tmp/bash-dir-a
/tmp/bash-dir-a
/tmp/bash-dir-a
/
./source5.sub: line 23: /tmp/source-notthere: No such file or directory
after bad source 1
./source5.sub: line 30: /tmp/source-notthere: No such file or directory
one - OK
0
0
two - OK
0
three - OK
0
four - OK
0
abc
def
ghi
after
one.1 subshell
two.1 subshell
three.1 subshell
four.1 subshell
one.2 subshell
two.2 subshell
three.2 subshell
four.2 subshell
x29 - done
abc
def
ghi
ok
./source8.sub: line 40: improbable-filename: No such file or directory
./source8.sub: line 41: improbable-filename: No such file or directory
an improbable filename
an improbable filename
an improbable filename
an improbable filename
file in the current directory
./source8.sub: line 55: .: cwd-filename: file not found
file in the current directory
bash: line 1: .: cwd-filename: file not found
bash: line 1: .: cwd-filename: file not found
file in the current directory
file in the current directory
AVAR
foo
foo
AVAR
foo
foo
AVAR
foo
declare -x foo=""
declare -x FOO="\$\$"
./builtins.tests: line 242: declare: FOO: not found
declare -x FOO="\$\$"
ok
ok
./builtins.tests: line 274: kill: 4096: invalid signal specification
1
a\n\n\nb
a
b
-p
a b c
before: f = 4
inside
after: f = 8 bar = 4
declare -a c
declare -A d
declare -a c=([0]="4")
declare -A c=([0]="4" )
declare -a c=([0]="1" [1]="2" [2]="3")
declare -A c=([two]="2" [three]="3" [one]="1" )
declare -a c=([0]="1" [1]="2" [2]="3")
declare -a c=([0]="1" [1]="2" [2]="3")
unset
unset
assoc 1 unset
array 1 unset
assoc 2 unset
array 2 unset
unset1
unset2
1
1
1
1
0
0
assoc A unset
array a
assoc A
array a
assoc B unset
array b unset
assoc B unset
array b unset
scalar 1
scalar 2
scalar 3 unset
argv[1] = <one two three>
assoc: 3
array: 3
scalar: 13
scalar: 1
scalar: 0
scalar: 1
scalar: 0
scalar: 0
all set:
one
two
f1 ()
{
echo f1
}
f2 ()
{
echo f2
}
all unset:
unset1
unset2
./builtins6.sub: line 41: declare: f1: not found
./builtins6.sub: line 41: declare: f2: not found
all reset:
one-one
two-one
f1 ()
{
echo f1
}
f2 ()
{
echo f2
}
vars unset:
unset1
unset2
f1 ()
{
echo f1
}
f2 ()
{
echo f2
}
funcs unset:
one-two
two-two
bash: line 1: notthere: No such file or directory
one
bash: line 1: notthere: No such file or directory
two
bash: line 1: .: notthere: file not found
one
bash: line 1: .: notthere: file not found
0
0
0
0
argv[1] = <one>
0
argv[1] = <two>
0
three
0
four
0
./builtins7.sub: line 19: : command not found
127
0
./builtins7.sub: line 27: notthere: No such file or directory
after 1
./builtins7.sub: line 28: notthere: No such file or directory
after 2
type is a shell builtin
+ command -v type
type
+ command command -v type
type
+ command -p command -v type
type
+ command -p -- command -v type
type
+ set +x
u=rw,g=rx,o=rx
u=r,g=rx,o=rx
u=rwx,g=rwx,o=
u=rw,g=wx,o=rx
u=rx,g=rx,o=rx
u=rwx,g=rx,o=rwx
u=rwx,g=rwx,o=rx
u=rx,g=rx,o=rx
u=rwx,g=rx,o=rx
u=rwx,g=rwx,o=rwx
u=rwx,g=rwx,o=rwx
u=rwx,g=rx,o=rx
u=rwx,g=rx,o=rx
u=rwx,g=rx,o=rx
u=rwx,g=rx,o=rx
u=rwx,g=rx,o=rx
u=rwx,g=rx,o=rx
u=rwx,g=rx,o=x
hash: hash table empty
./builtins9.sub: line 19: hash: notthere: not found
1
/nosuchdir/nosuchfile
builtin hash -p /nosuchdir/nosuchfile cat
builtin hash -p /nosuchdir/nosuchfile cat
./builtins9.sub: line 30: hash: notthere: not found
./builtins9.sub: line 32: hash: notthere: not found
./builtins9.sub: line 33: hash: notthere: not found
1
./builtins9.sub: line 40: /nosuchdir/nosuchfile: No such file or directory
127
/nosuchdir/nosuchfile
0
0
found
./builtins9.sub: line 52: hash: /: Is a directory
builtin hash -p /nosuchfile cat
./builtins10.sub: line 17: help: -x: invalid option
help: usage: help [-dms] [pattern ...]
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
A star (*) next to a name means that the command is disabled.
! PIPELINE history [-c] [-d offset] [n] or hist>
job_spec [&] if COMMANDS; then COMMANDS; [ elif C>
(( expression )) jobs [-lnprs] [jobspec ...] or jobs >
. [-p path] filename [arguments] kill [-s sigspec | -n signum | -sigs>
: let arg [arg ...]
[ arg... ] local [option] name[=value] ...
[[ expression ]] logout [n]
alias [-p] [name[=value] ... ] mapfile [-d delim] [-n count] [-O or>
bg [job_spec ...] popd [-n] [+N | -N]
bind [-lpsvPSVX] [-m keymap] [-f file> printf [-v var] format [arguments]
break [n] pushd [-n] [+N | -N | dir]
builtin [shell-builtin [arg ...]] pwd [-LP]
caller [expr] read [-Eers] [-a array] [-d delim] [>
case WORD in [PATTERN [| PATTERN]...)> readarray [-d delim] [-n count] [-O >
cd [-L|[-P [-e]]] [-@] [dir] readonly [-aAf] [name[=value] ...] o>
command [-pVv] command [arg ...] return [n]
compgen [-V varname] [-abcdefgjksuv] > select NAME [in WORDS ... ;] do COMM>
complete [-abcdefgjksuv] [-pr] [-DEI]> set [-abefhkmnptuvxBCEHPT] [-o optio>
compopt [-o|+o option] [-DEI] [name .> shift [n]
continue [n] shopt [-pqsu] [-o] [optname ...]
coproc [NAME] command [redirections] source [-p path] filename [argument>
declare [-aAfFgiIlnrtux] [name[=value> suspend [-f]
dirs [-clpv] [+N] [-N] test [expr]
disown [-h] [-ar] [jobspec ... | pid > time [-p] pipeline
echo [-neE] [arg ...] times
enable [-a] [-dnps] [-f filename] [na> trap [-Plp] [[action] signal_spec ..>
eval [arg ...] true
exec [-cl] [-a name] [command [argume> type [-afptP] name [name ...]
exit [n] typeset [-aAfFgiIlnrtux] name[=value>
export [-fn] [name[=value] ...] or ex> ulimit [-SHabcdefiklmnpqrstuvxPRT] [>
false umask [-p] [-S] [mode]
fc [-e ename] [-lnr] [first] [last] o> unalias [-a] name [name ...]
fg [job_spec] unset [-f] [-v] [-n] [name ...]
for NAME [in WORDS ... ] ; do COMMAND> until COMMANDS; do COMMANDS-2; done
for (( exp1; exp2; exp3 )); do COMMAN> variables - Names and meanings of so>
function name { COMMANDS ; } or name > wait [-fn] [-p var] [id ...]
getopts optstring name [arg ...] while COMMANDS; do COMMANDS-2; done
hash [-lr] [-p pathname] [-dt] [name > { COMMANDS ; }
help [-dms] [pattern ...]
help: help [-dms] [pattern ...]
shift - Shift positional parameters.
shift: shift [n]
Shift positional parameters.
Rename the positional parameters $N+1,$N+2 ... to $1,$2 ... If N is
not given, it is assumed to be 1.
Exit Status:
Returns success unless N is negative or greater than $#.
builtin: builtin [shell-builtin [arg ...]]
shift: shift [n]
Shell commands matching keyword `read*'
read: read [-Eers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
readarray: readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
readonly: readonly [-aAf] [name[=value] ...] or readonly -p
read: read [-Eers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p prompt] [-t timeout] [-u fd] [name ...]
readarray: readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C callback] [-c quantum] [array]
readonly: readonly [-aAf] [name[=value] ...] or readonly -p
:: :
Null command.
No effect; the command does nothing.
Exit Status:
Always succeeds.
NAME
: - Null command.
SYNOPSIS
:
DESCRIPTION
Null command.
No effect; the command does nothing.
Exit Status:
Always succeeds.
SEE ALSO
bash(1)
IMPLEMENTATION
Copyright (C) 2025 Free Software Foundation, Inc.
These shell commands are defined internally. Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.
A star (*) next to a name means that the command is disabled.
! PIPELINE history [-c] [-d offset] [n] or hist>
job_spec [&] if COMMANDS; then COMMANDS; [ elif C>
(( expression )) jobs [-lnprs] [jobspec ...] or jobs >
. [-p path] filename [arguments] kill [-s sigspec | -n signum | -sigs>
: let arg [arg ...]
[ arg... ] local [option] name[=value] ...
[[ expression ]] logout [n]
alias [-p] [name[=value] ... ] mapfile [-d delim] [-n count] [-O or>
bg [job_spec ...] popd [-n] [+N | -N]
bind [-lpsvPSVX] [-m keymap] [-f file> printf [-v var] format [arguments]
break [n] pushd [-n] [+N | -N | dir]
builtin [shell-builtin [arg ...]] pwd [-LP]
caller [expr] read [-Eers] [-a array] [-d delim] [>
case WORD in [PATTERN [| PATTERN]...)> readarray [-d delim] [-n count] [-O >
cd [-L|[-P [-e]]] [-@] [dir] readonly [-aAf] [name[=value] ...] o>
command [-pVv] command [arg ...] return [n]
compgen [-V varname] [-abcdefgjksuv] > select NAME [in WORDS ... ;] do COMM>
complete [-abcdefgjksuv] [-pr] [-DEI]> set [-abefhkmnptuvxBCEHPT] [-o optio>
compopt [-o|+o option] [-DEI] [name .> shift [n]
continue [n] shopt [-pqsu] [-o] [optname ...]
coproc [NAME] command [redirections] source [-p path] filename [argument>
declare [-aAfFgiIlnrtux] [name[=value> suspend [-f]
dirs [-clpv] [+N] [-N] test [expr]
disown [-h] [-ar] [jobspec ... | pid > time [-p] pipeline
echo [-neE] [arg ...] times
enable [-a] [-dnps] [-f filename] [na> trap [-Plp] [[action] signal_spec ..>
eval [arg ...] true
exec [-cl] [-a name] [command [argume> type [-afptP] name [name ...]
exit [n] typeset [-aAfFgiIlnrtux] name[=value>
export [-fn] [name[=value] ...] or ex> ulimit [-SHabcdefiklmnpqrstuvxPRT] [>
false umask [-p] [-S] [mode]
fc [-e ename] [-lnr] [first] [last] o> unalias [-a] name [name ...]
fg [job_spec] unset [-f] [-v] [-n] [name ...]
for NAME [in WORDS ... ] ; do COMMAND> until COMMANDS; do COMMANDS-2; done
for (( exp1; exp2; exp3 )); do COMMAN> variables - Names and meanings of so>
function name { COMMANDS ; } or name > wait [-fn] [-p var] [id ...]
getopts optstring name [arg ...] while COMMANDS; do COMMANDS-2; done
hash [-lr] [-p pathname] [-dt] [name > { COMMANDS ; }
help [-dms] [pattern ...]
./builtins10.sub: line 39: help: no help topics match `bash'. Try `help help' or `man -k bash' or `info bash'.
unlimited
unlimited
./builtins11.sub: line 27: ulimit: +1999: invalid number
0
0
./builtins11.sub: line 37: ulimit: -g: invalid option
ulimit: usage: ulimit [-SHabcdefiklmnpqrstuvxPRT] [limit]
./builtins11.sub: line 39: ulimit: max user processes: cannot modify limit: Operation not permitted
/tmp /bin
/tmp /bin
/bin /tmp
./builtins12.sub: line 21: pushd: -x: invalid number
pushd: usage: pushd [-n] [+N | -N | dir]
/tmp
./builtins12.sub: line 24: popd: -x: invalid number
popd: usage: popd [-n] [+N | -N]
/ /tmp
./builtins12.sub: line 27: popd: dir: invalid argument
popd: usage: popd [-n] [+N | -N]
/
/tmp
/tmp /
/bin /tmp /
./builtins12.sub: line 35: popd: -8: directory stack index out of range
./builtins12.sub: line 36: popd: +8: directory stack index out of range
/tmp /
/
./builtins.tests: line 325: exit: status: numeric argument required
after non-numeric arg to exit: 2