Skip to content

Instantly share code, notes, and snippets.

@kawaz
Created August 6, 2012 05:11
Show Gist options
  • Select an option

  • Save kawaz/3270900 to your computer and use it in GitHub Desktop.

Select an option

Save kawaz/3270900 to your computer and use it in GitHub Desktop.
cdにディレクトリ以外のパスを渡してもいい感じにしてくれるようにする
#!/bin/sh
function cd() {
if [ -e "$1" -a ! -d "$1" ]; then
builtin cd "`dirname "$1"`"
else
builtin cd "$@"
fi
}
@kawaz
Copy link
Copy Markdown
Author

kawaz commented Aug 6, 2012

これをbashrcに書いておいて何か問題になりそうなことあるかな?
今のところ思いつかないんだけど、何かあれば指摘歓迎。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment