]>
Commit | Line | Data |
---|---|---|
d166f048 JA |
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 | |
7117c2d2 | 9 | type -r ${THIS_SH} |
d166f048 JA |
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 | |
d166f048 JA |
22 | type -t builtin |
23 | type -t /bin/sh | |
24 | type -t ${THIS_SH} | |
cce855bc | 25 | type -t mv |
d166f048 JA |
26 | |
27 | type func | |
28 | # the following two should produce identical output | |
29 | type while | |
30 | type -a while | |
d166f048 JA |
31 | type builtin |
32 | type /bin/sh | |
33 | ||
34 | command -v func | |
35 | command -V func | |
36 | command -v while | |
37 | command -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) |
42 | type -t m | |
43 | type m | |
d166f048 JA |
44 | command -v m |
45 | alias -p | |
46 | alias m | |
b80f6443 JA |
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 | ||
d166f048 | 56 | command -V m |
b80f6443 JA |
57 | shopt -u expand_aliases |
58 | ||
d166f048 JA |
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 | ||
cce855bc JA |
69 | hash -r |
70 | ||
d166f048 JA |
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 | |
cce855bc JA |
78 | |
79 | type -t $SHBASE | |
80 | ||
81 | # make sure the hash table looks right | |
82 | hash | |
3185942a JA |
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 | |
0001803f CR |
92 | |
93 | ${THIS_SH} type2.sub | |
495aee44 CR |
94 | |
95 | ${THIS_SH} type3.sub | |
ac50fbac CR |
96 | |
97 | ${THIS_SH} type4.sub |