Last active
December 22, 2015 14:48
-
-
Save sleepygarden/6487791 to your computer and use it in GitHub Desktop.
Clear up zsh - when changing dirs without cd, will check if that will conflict with a command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
. ~/.zshrc | |
check_for_collision(){ | |
is_exec=false | |
is_dir=false | |
if [ -d $FOO ]; then | |
is_dir=true | |
fi | |
alias $FOO > /dev/null && is_exec=true | |
echo "E"$is_exec | |
echo "D"$is_dir | |
if $is_exec && $is_dir ;then | |
echo "Collision!" | |
else | |
$FOO | |
} | |
FOO=$1 | |
check_for_collision |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment