Created
May 9, 2022 08:47
-
-
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
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
#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