Allow EMCC_BASH to force bash during construct_env (#493)

This allows `emsdk_env.sh` to work under bash for windows even in the
absence of the `MSYSTEM` environment variable (which seems to be 
the setup on circle CI. 
diff --git a/emsdk.py b/emsdk.py
index cc6e83f..ce9aaf8 100755
--- a/emsdk.py
+++ b/emsdk.py
@@ -48,13 +48,9 @@
 VERBOSE = int(os.getenv('EMSDK_VERBOSE', '0'))
 TTY_OUTPUT = not os.getenv('EMSDK_NOTTY', not sys.stdout.isatty())
 
-POWERSHELL = bool(os.getenv('EMSDK_POWERSHELL'))
-CSH = bool(os.getenv('EMSDK_CSH'))
-
 WINDOWS = False
 if os.name == 'nt' or (os.getenv('SYSTEMROOT') is not None and 'windows' in os.getenv('SYSTEMROOT').lower()) or (os.getenv('COMSPEC') is not None and 'windows' in os.getenv('COMSPEC').lower()):
   WINDOWS = True
-  ENVPATH_SEPARATOR = ';'
 
 MINGW = False
 MSYS = False
@@ -72,15 +68,35 @@
 OSX = False
 if platform.mac_ver()[0] != '':
   OSX = True
-  ENVPATH_SEPARATOR = ':'
 
 LINUX = False
 if not OSX and (platform.system() == 'Linux' or os.name == 'posix'):
   LINUX = True
-  ENVPATH_SEPARATOR = ':'
 
 UNIX = (OSX or LINUX)
 
+
+# Pick which shell of 4 shells to use
+POWERSHELL = bool(os.getenv('EMSDK_POWERSHELL'))
+CSH = bool(os.getenv('EMSDK_CSH'))
+CMD = bool(os.getenv('EMSDK_CMD'))
+BASH = bool(os.getenv('EMSDK_BASH'))
+if WINDOWS and BASH:
+  MSYS = True
+
+if not CSH and not POWERSHELL and not BASH and not CMD:
+  # Fall back to default of `cmd` on windows and `bash` otherwise
+  if WINDOWS and not MSYS:
+    CMD = True
+  else:
+    BASH = True
+
+if WINDOWS:
+  ENVPATH_SEPARATOR = ';'
+else:
+  ENVPATH_SEPARATOR = ':'
+
+
 ARCH = 'unknown'
 # platform.machine() may return AMD64 on windows, so standardize the case.
 machine = platform.machine().lower()
@@ -2583,12 +2599,15 @@
   if os.environ['PATH'] != newpath:
     if POWERSHELL:
       env_string += '$env:PATH="' + newpath + '"\n'
-    elif WINDOWS and not MSYS:
+    elif CMD:
       env_string += 'SET PATH=' + newpath + '\n'
     elif CSH:
       env_string += 'setenv PATH "' + newpath + '"\n'
-    else:
+    elif BASH:
       env_string += 'export PATH="' + newpath + '"\n'
+    else:
+      assert False
+
     if len(added_path) > 0:
       print('Adding directories to PATH:')
       for item in added_path:
@@ -2623,15 +2642,17 @@
     for key, value in env_vars_to_add:
       if POWERSHELL:
         env_string += '$env:' + key + '="' + value + '"\n'
-      elif WINDOWS and not MSYS:
+      elif CMD:
         if permanent:
           env_string += 'SETX ' + key + ' "' + value + '"\n'
         else:
           env_string += 'SET ' + key + '=' + value + '\n'
       elif CSH:
         env_string += 'setenv ' + key + ' "' + value + '"\n'
-      else:
+      elif BASH:
         env_string += 'export ' + key + '="' + value + '"\n'
+      else:
+        assert False
       print(key + ' = ' + value)
     print('')
   return env_string
diff --git a/emsdk_env.sh b/emsdk_env.sh
index 6861615..1e972a3 100755
--- a/emsdk_env.sh
+++ b/emsdk_env.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
 # This script is sourced by the user and uses
 # their shell. Try not to use bashisms.
 
@@ -23,7 +24,8 @@
 unset SRC
 
 tmpfile=`mktemp` || exit 1
-./emsdk construct_env $tmpfile
+# Force emsdk to use bash syntax so that this works in windows + bash too
+EMSDK_BASH=1 ./emsdk construct_env $tmpfile
 . $tmpfile
 rm -f $tmpfile