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
cd() { | |
# Check if no arguments to make just typing cd<Enter> work | |
# Also check if the first argument starts with a - and let cd handle it | |
if [ $# -eq 0 ] || [[ $1 == -* ]] | |
then | |
builtin cd $@ | |
return | |
fi | |
# If path exists, just cd into it | |
# (also, using $* and not $@ makes it so you don't have to escape spaces any more) |