Created
August 26, 2020 11:08
-
-
Save naryal2580/550ce1e279d961d81476e335c3a4df49 to your computer and use it in GitHub Desktop.
Either source this on .bashrc or copy and paste it to your .bashrc of WSL you are working on, and forget appending .exe on commands like powershell and cmd
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
trap 'BASH_CMD=$BASH_COMMAND' DEBUG | |
command_not_found_handle () { | |
only_cmd=${BASH_CMD%% *} | |
if type "$only_cmd.exe" | |
then | |
only_args=${BASH_CMD#* } | |
cmd="$only_cmd.exe $only_args" | |
$cmd | |
else | |
echo "-bash: $only_cmd: Command not found" | |
return 127 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment