Last active
April 11, 2019 07:59
-
-
Save alexaandrov/b0408ef44bc78d87b8f3e922937569cf to your computer and use it in GitHub Desktop.
WSL for vagrant in git bash
This file contains hidden or 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
# Convert path from windows to linux | |
function lpwd() | |
{ | |
pwd=$(pwd) | |
windowsHome=$(echo $HOME) | |
linuxHome="~" | |
lpwd=${pwd/$windowsHome/$linuxHome} | |
echo $lpwd | |
} | |
# WSL emulation for vagrant | |
function wsl() | |
{ | |
pwd=$(lpwd) | |
case $1 in | |
"") | |
command="cd $pwd; /bin/bash" | |
;; | |
*) | |
command="cd $pwd; $@" | |
;; | |
esac | |
eval "ssh -t vagrant '$command'" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
user@pc MINGW64 ~/
$ python --version
Python 3.7.2
user@pc MINGW64 ~/
$ wsl python --version
Python 2.7.5
Connection to localhost closed.
user@pc MINGW64 ~/Projects/wsl
$ ls
wsl.sh
user@pc MINGW64 ~/Project/wsl
$ wsl ls
wsl.sh
Connection to localhost closed.