linux - 我可以在 Windows 中运行 Linux shell 脚本吗?

标签 linux windows shell git-bash

我在 Linux 上创建了 Shell 脚本,它运行良好。

现在我想使用 gitbash 在 Windows 上运行相同的脚本。 (仅针对 Windows 更改了文件路径)

我很困惑:

  • 是否需要按照Windows语法shell脚本重新编写一个新的shell脚本?

  • Linux 语法 shell 脚本可以在 Windows 上运行而无需更改吗?

根据differences-between-windows-batch-and-linux-bash-shell-script-syntax

最佳答案

当然可以。有一个工具叫做 cygwin这使您可以这样做。

请注意,您必须检查路径是什么。如果是这样,请转到您愿意工作的路径并执行 pwd。这样,您将获得 Windows\kind\of\path

我一直在使用它,而且效果很好。

关于linux - 我可以在 Windows 中运行 Linux shell 脚本吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27858806/

相关文章:

c# - 如何在用户注销或关闭 Windows 时延迟关闭应用程序?

linux - 是否可以在 Perl 中监视 LXTerminal(shell) 输出?

c - 以亚微秒精度测量 Linux 内核空间中的时间

c# - 使用java或其他编程语言将小图标添加到任何文件/文件夹作为Windows中的图标

windows - 使用任务管理器生成转储文件

shell - 来自curl输出的Grep状态代码

linux - 可移植的 bourne shell 脚本,无需使用 bash、ksh、zsh 等现代 shell 的功能

linux - 在centOS上安装ruby on Rails

linux - 输出保持不变

c - 在 Linux 中启动 GDB 时如何传递命令行参数?