【发布时间】:2016-04-11 14:38:27
【问题描述】:
我想编写一个在 Windows 7 平台上运行一些 git 命令的脚本。
用户安装了 git 工具或至少安装了 MINGW - Windows 的极简 GNU。
问题是一些用户从 MINGW32 shell 运行,而另一些用户从 cmd.exe 运行。
使用 MINGW32 外壳的示例外壳:
$ echo $SHELL
/bin/sh
使用 cmd.exe 的示例 shell
>echo %COMSPEC%
C:\Windows\system32\cmd.exe
有什么方法可以从我的初始脚本中确定 shell,然后可能运行 Windows 批处理文件或其他 unix 脚本?
或者另一个想法是假设用户将使用 git bash 并检查 $SHELL 是 /bin/sh。这更容易吗?
【问题讨论】:
标签: windows git shell cmd mingw