大家好。我给了一个git-bash安装,并希望一些自动化。我有一个.bat文件,我想以
some.bat param | iconv -cp1251 > l.log | tail -f l.log我不想在WinCMD中运行它,而是在git-bash shell中运行--请告诉我怎么做?
发布于 2017-07-04 20:41:33
windows上的Git bash使用BASH。您可以使用bash创建一个快速脚本,该脚本可以接受参数并回显它们,这样您就可以通过管道将它们传递给您的下一个实用程序。
它可能看起来像这样
文件: some.sh
#!/bin/bash
#Lots of fun bash scripting here...
echo $1
# $1 here is the first parameter sent to this script.
# $2 is the second... etc. $0 is the script name 然后通过将some.sh设置为可执行文件
$ chmod +x some.sh然后,您将能够在git-bash shell中执行它
./some.sh param | cat ... etc | etc...您可以阅读有关bash编程的文章。
我建议您查看一些bash脚本教程,如this one
https://stackoverflow.com/questions/44906075
复制相似问题