title: Shell script to check if running in Windows when using WSL?
body: <p>I'm trying to add a conditional to my .zshrc file that will initialize some config stuff that I only want to happen if I'm in Windows Subsystem for Linux. I tried this but no luck: </p>
  
  <pre><code>if [ "$('cmd.exe /c "systeminfo" | grep "^OS Name"')" =~ "Windows" ]; then
          echo "windows baby!"
  fi
  </code></pre>
  
  <p>Which gives:</p>
  
  <pre><code>no such file or directory: cmd.exe /c "systeminfo" | grep "^OS Name"
  </code></pre>
  
  <p>...but that command works if I type it directly in the shell.
  Any ideas?</p>