【发布时间】:2015-03-07 16:05:18
【问题描述】:
我在 Linux 上创建了 Shell 脚本,它运行良好。
现在我想使用gitbash 在 Windows 上运行相同的脚本。 (仅更改了 Windows 的文件路径)
我很困惑:
- 是否需要根据Windows语法shell脚本重新编写一个新的shell脚本?
或
- Linux 语法 shell 脚本可以在 Windows 上运行而不需要更改吗?
根据differences-between-windows-batch-and-linux-bash-shell-script-syntax
【问题讨论】:
-
你可以在windows上运行
bash,以及一些其他的UNIX shell(ash,tcsh)......但是,你可能会遇到很多小问题,如Windows & UNIX 非常不同......如果你想制作跨平台的东西,我建议使用 Python、Java、Ruby 或其他更适合这项工作的语言。 -
如果你写了一个Shell脚本,你可以在Windows中使用
cygwin运行它。 -
这里下载cygwin
-
@fedorqui 在我的学习中 'cygwin' 和 'gitbash' 为 windows 做同样的事情
标签: linux windows shell git-bash