[英]Can I run a Linux shell script in Windows?
I created Shell Script on Linux and it runs fine. 我在Linux上创建了Shell脚本,并且运行良好。
Now I want to run the same script on Windows using gitbash
. 现在,我想使用gitbash
在Windows上运行相同的脚本。 (Only filepath changed for windows) (仅对于Windows更改了文件路径)
I am confused: 我很困惑:
or 要么
According TO differences-between-windows-batch-and-linux-bash-shell-script-syntax 根据TO 之间的差异-Windows批处理和Linux Bash Shell脚本语法
Of course you can. 当然可以。 There is a tool called cygwin
that allows you to do so. 有一个名为cygwin
的工具可让您执行此操作。
Note that you have to check what the paths are. 请注意,您必须检查路径。 If so, go to the path you are willing to work on and do pwd
. 如果是这样,请转到您愿意尝试的路径并执行pwd
。 This way, you will get the Windows\\kind\\of\\path
. 这样,您将获得Windows\\kind\\of\\path
。
I use it all the time and it works pretty fine. 我一直使用它,并且效果很好。
It depends on how advanced the scripts are, but simple scripts can be executed in Git Bash. 这取决于脚本的高级程度,但是可以在Git Bash中执行简单的脚本。
test.sh contains: test.sh包含:
#!/bin/bash
echo Hello World!
Execute script: 执行脚本:
./test.sh
Output: 输出:
Hello World!
To answer your question: 要回答您的问题:
@fedorqui in my learning 'cygwin' And 'gitbash' do same stuff for windows 我学习的“ cygwin”中的@fedorqui和“ gitbash”在Windows中执行相同的操作
Git Bash 吉特·巴什
Git Bash is lightweight and only aims to handle: Git Bash是轻量级的,仅旨在处理:
Read more: http://openhatch.org/missions/windows-setup/install-git-bash 了解更多: http : //openhatch.org/missions/windows-setup/install-git-bash
Cygwin Cygwin的
Read more: https://www.cygwin.com/ 了解更多: https : //www.cygwin.com/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.