]> git.ipfire.org Git - thirdparty/bash.git/blame - tests/type.tests
Bash-4.3 patch 7
[thirdparty/bash.git] / tests / type.tests
CommitLineData
d166f048
JA
1set +o posix
2
3hash -r
4unalias -a
5
6# this should echo nothing
7type
8# this should be a usage error
7117c2d2 9type -r ${THIS_SH}
d166f048
JA
10
11# these should behave identically
12type notthere
13command -v notthere
14
15alias m=more
16
17unset -f func 2>/dev/null
18func() { echo this is func; }
19
20type -t func
21type -t while
d166f048
JA
22type -t builtin
23type -t /bin/sh
24type -t ${THIS_SH}
cce855bc 25type -t mv
d166f048
JA
26
27type func
28# the following two should produce identical output
29type while
30type -a while
d166f048
JA
31type builtin
32type /bin/sh
33
34command -v func
35command -V func
36command -v while
37command -V while
b80f6443 38
95732b49
JA
39# the following two lines should produce the same output
40# post-3.0 patch makes command -v silent, as posix specifies
b80f6443
JA
41# first test with alias expansion off (should all fail or produce no output)
42type -t m
43type m
d166f048
JA
44command -v m
45alias -p
46alias m
b80f6443
JA
47
48# then test with alias expansion on
49shopt -s expand_aliases
50type m
51type -t m
52command -v m
53alias -p
54alias m
55
d166f048 56command -V m
b80f6443
JA
57shopt -u expand_aliases
58
d166f048
JA
59command -v builtin
60command -V builtin
61command -v /bin/sh
62command -V /bin/sh
63
64unset -f func
65type func
66unalias m
67type m
68
cce855bc
JA
69hash -r
70
d166f048
JA
71hash -p /bin/sh sh
72type -p sh
73
74SHBASE=${THIS_SH##*/}
75hash -p /tmp/$SHBASE $SHBASE
76type -p $SHBASE
77type $SHBASE
cce855bc
JA
78
79type -t $SHBASE
80
81# make sure the hash table looks right
82hash
3185942a
JA
83
84# bug in versions of bash up to and including bash-3.2
85f() {
86 v=$'\001'
87 }
88
89type f | cat -v
90
91${THIS_SH} type1.sub
0001803f
CR
92
93${THIS_SH} type2.sub
495aee44
CR
94
95${THIS_SH} type3.sub
ac50fbac
CR
96
97${THIS_SH} type4.sub