使用带有空间参数值的运行命令和apache命令行 [英] Running command with with space argument value with apache command line
本文介绍了使用带有空间参数值的运行命令和apache命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用apache命令行库,我想从java程序执行
I'm using apache command line library and I want to execute from java program
git stash list --format=%gd:%at:%B --grep="some text with space"
这是code
commandLine.addArgument( - grep = \+ filter +\,false);
它在Windows上运行没有任何问题,但在linux上没有。
如果我从终端执行命令它正确执行
this is the code commandLine.addArgument( "--grep=\"" + filter+"\"", false); it is run on windows without any problem but on linux does not. If i execute the command from terminal it is execute correctly
我还试图让apache库放置引号
I also tried to let apache library to put quoting
commandLine.addArgument( "--grep=" + filter);
但是我得到了
fatal: bad revision '"--grep=text message"'
推荐答案
虽然有一个有关Common Exec中报价管理的错误,此答案建议:
// When writing a command with space use double "
cmdLine.addArgument(--grep=\"\"" + filter+"\"\"", false"\"\"",false);
这篇关于使用带有空间参数值的运行命令和apache命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文