File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -13,20 +13,28 @@ if [[ "$output" =~ $regex ]]; then
13
13
fi
14
14
fi
15
15
16
- # mkdir foo && bar
16
+ # mkdir foo && (foo || 1s || .\foo)
17
17
regex=" bash: (.*): command not found"
18
18
if [[ " $output " =~ $regex ]]; then
19
19
20
+ # If directory exists
21
+ if [[ -d " ${BASH_REMATCH[1]} " ]]; then
22
+ echo " Did you mean to run \` cd ${BASH_REMATCH[1]} \` ?"
23
+ exit
24
+ fi
25
+
20
26
# If typo
21
27
if [[ " ${BASH_REMATCH[1]} " == " 1s" ]]; then
22
28
echo " Did you mean to run \` ls\` (which starts with a lowercase L)?"
23
29
exit
24
30
fi
25
31
26
- # If directory exists
27
- if [[ -d " ${BASH_REMATCH[1]} " ]]; then
28
- echo " Did you mean to run \` cd ${BASH_REMATCH[1]} \` ?"
29
- exit
32
+ # If backslash instead of forward slash
33
+ if [[ " ${BASH_REMATCH[1]} " =~ ^\. (.* ) ]]; then
34
+ if [[ -f " ./${BASH_REMATCH[1]} " ]]; then
35
+ echo " Did you mean to run \` ./${BASH_REMATCH[1]} \` , with a forward slash instead?"
36
+ exit
37
+ fi
30
38
fi
31
39
fi
32
40
You can’t perform that action at this time.
0 commit comments