See if You Run a Bash Script in WSL
1 min read

WSL in Bash

The simplest way to see if the script is called from a WSL environment is like this.

if grep -q Microsoft /proc/version; then
    # it's from wsl
fi