Created
August 6, 2012 05:11
-
-
Save kawaz/3270900 to your computer and use it in GitHub Desktop.
cdにディレクトリ以外のパスを渡してもいい感じにしてくれるようにする
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/sh | |
function cd() { | |
if [ -e "$1" -a ! -d "$1" ]; then | |
builtin cd "`dirname "$1"`" | |
else | |
builtin cd "$@" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
これをbashrcに書いておいて何か問題になりそうなことあるかな?
今のところ思いつかないんだけど、何かあれば指摘歓迎。