WSL: Try to run .exe versions if they exist and the non .exe version doesn't
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
# WSL: Try to run .exe versions if they exist and the non .exe version doesn't | |
command_not_found_handle() { | |
if cmd.exe /c "(where $1 || (help $1 |findstr /V Try)) >nul 2>nul && ($* || exit 0)"; then | |
return $? | |
else | |
if [ -x /usr/lib/command-not-found ]; then | |
/usr/lib/command-not-found -- "$1" | |
return $? | |
elif [ -x /usr/share/command-not-found/command-not-found ]; then | |
/usr/share/command-not-found/command-not-found -- "$1" | |
return $? | |
else | |
printf "%s: command not found\n" "$1" >&2 | |
return 127 | |
fi | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment