我已经为Linux提供了完美的构建脚本。目前,我想适应Cygwin的构建,使它跨平台。问题是构建脚本使用管道重定向,比如|和>,当使用Cygwin的‘bash-c’时,需要用^转义。
我想知道是否有任何解决方案可以避免为Cygwin转义每个管道重定向符号,比如bash命令行选项或env。
例子:
ls -l | tee 1.log在Linux中工作得很好,需要按照下面的方式与Cygwin的bash -c一起使用
ls -l ^| tee 1.log
在我的服务器上,我无法在使用popen时将错误重定向到文本文件。以下代码:
popen("echo 'this part works' &> /wwwroot/output.txt &","r");
popen("noCommandThatExist &>> /wwwroot/output.txt &","r");
在我的机器上有以下输出:
this part works
sh: noCommandThatExist: command not found
而是服务器