Line | |
---|
1 | export LC_ALL=C
|
---|
2 | export LANG=C
|
---|
3 |
|
---|
4 | dirs -c
|
---|
5 | # error -- nonexistant directory
|
---|
6 | pushd /tmp/xxx-notthere
|
---|
7 |
|
---|
8 | # errors -- empty stack
|
---|
9 | pushd
|
---|
10 | popd
|
---|
11 |
|
---|
12 | # errors -- bad numeric arguments -- should not cause the script to exit
|
---|
13 | pushd -m
|
---|
14 | popd -m
|
---|
15 | dirs -m
|
---|
16 | dirs 7
|
---|
17 |
|
---|
18 | MYDIR=$PWD
|
---|
19 | unalias cd 2>/dev/null
|
---|
20 |
|
---|
21 | unalias -a
|
---|
22 |
|
---|
23 | command cd -P /
|
---|
24 | command pwd -P # better be `/'
|
---|
25 |
|
---|
26 | case "$OLDPWD" in
|
---|
27 | $MYDIR) echo ok ;;
|
---|
28 | *) echo oops -- bad \$OLDPWD ;;
|
---|
29 | esac
|
---|
30 |
|
---|
31 | pushd /usr
|
---|
32 | echo $PWD $OLDPWD
|
---|
33 | dirs
|
---|
34 | echo ${DIRSTACK[@]}
|
---|
35 |
|
---|
36 | # this should not change the directory stack at all
|
---|
37 | pushd -n +0
|
---|
38 | dirs
|
---|
39 |
|
---|
40 | popd
|
---|
41 | pushd /usr
|
---|
42 |
|
---|
43 | pushd /etc
|
---|
44 | dirs
|
---|
45 | dirs -l
|
---|
46 | dirs -v
|
---|
47 |
|
---|
48 | # two consecutive `pushd's should swap the top two stack elements, then
|
---|
49 | # swap them back, leaving the stack intact
|
---|
50 | pushd
|
---|
51 | pushd
|
---|
52 |
|
---|
53 | pushd /tmp
|
---|
54 | echo ${DIRSTACK[0]} ; dirs +0
|
---|
55 | echo ${DIRSTACK[2]} ; dirs +2
|
---|
56 |
|
---|
57 | # these should be errors, but not affect the directory stack
|
---|
58 | dirs +9; dirs -9
|
---|
59 | pushd +9 ; pushd -9
|
---|
60 | popd +9 ; popd -9
|
---|
61 |
|
---|
62 | popd -n +2
|
---|
63 | dirs
|
---|
64 | echo ${DIRSTACK[@]}
|
---|
65 |
|
---|
66 | pushd -n /usr
|
---|
67 | echo $PWD
|
---|
68 | dirs
|
---|
69 | echo ${DIRSTACK[@]}
|
---|
70 |
|
---|
71 | builtin pwd
|
---|
72 |
|
---|
73 | DIRSTACK[1]=/bin
|
---|
74 | dirs
|
---|
75 |
|
---|
76 | builtin pwd
|
---|
77 | popd +2
|
---|
78 | builtin pwd -L
|
---|
79 | pushd -1
|
---|
80 | dirs
|
---|
81 | echo ${DIRSTACK[0]}
|
---|
82 |
|
---|
83 | dirs -c
|
---|
84 | dirs
|
---|
85 |
|
---|
86 | # this is for the benefit of pure coverage
|
---|
87 | cd $MYDIR
|
---|
Note:
See
TracBrowser
for help on using the repository browser.