Skip to content

Instantly share code, notes, and snippets.

@sleepygarden
Last active December 22, 2015 14:48
Show Gist options
  • Save sleepygarden/6487791 to your computer and use it in GitHub Desktop.
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.
#!/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