See if You Run a Bash Script in WSL

This is how you see if you are using WSL within a Bash script.

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