-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcdpath_test.sh
More file actions
executable file
·48 lines (39 loc) · 1.07 KB
/
cdpath_test.sh
File metadata and controls
executable file
·48 lines (39 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/zsh
# Test CDPATH behavior in zsh
echo "SHELL: $SHELL"
echo "CDPATH: $CDPATH"
echo "cdpath: ${cdpath[@]}"
# Test cd function
if typeset -f cd > /dev/null; then
echo "Found cd function:"
typeset -f cd
else
echo "No cd function found, using builtin"
fi
# Start from home directory
cd $HOME
echo "Starting from: $(pwd)"
# Test changing to a directory in CDPATH without path
echo "Trying to cd to a directory in CDPATH without path..."
cd src 2>&1
echo "Current directory: $(pwd)"
# Reset
cd $HOME
echo "Reset to: $(pwd)"
# Test using subdirectory in CDPATH
if [[ -d $HOME/src/bashrc ]]; then
echo "Trying to cd to a subdirectory of a CDPATH entry..."
cd bashrc 2>&1
echo "Current directory: $(pwd)"
# Reset
cd $HOME
echo "Reset to: $(pwd)"
# Try with full CDPATH search
echo "Trying cd with just the subdirectory name..."
cd bashrc 2>&1
echo "Current directory: $(pwd)"
fi
# Test autocompletion
echo ""
echo "To test autocompletion, run: cd ba<TAB>"
echo "It should complete to 'cd bashrc' if CDPATH is working correctly"