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