Skip to content

Instantly share code, notes, and snippets.

@mhewedy
Created May 9, 2022 08:47
Show Gist options
  • Save mhewedy/c32fe209032e8cdbcc1631fddb5d1713 to your computer and use it in GitHub Desktop.
Save mhewedy/c32fe209032e8cdbcc1631fddb5d1713 to your computer and use it in GitHub Desktop.
override the builtin function cd in .bashrc for wsl pathes to work automatically
#copy and paste in .bashrc and then: soruce .bashrc
# for windows pathes, you need to wrap it in double quotes
function cd() {
if [[ $@ == *"\\"* ]]; then
p=`wslpath "$@"`
builtin cd "$p"
else
builtin cd "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment