【发布时间】:2013-03-14 15:14:57
【问题描述】:
我希望 Apache Commons-exec 运行:
git 状态 |头-n1 |切-c13-
但似乎无法执行命令行并给出错误,有什么想法吗?
CommandLine cmdLine = CommandLine.parse( "git status | head -n1 | cut -c13-" );
DefaultExecutor executor = new DefaultExecutor();
executor.setWorkingDirectory( file );
executor.execute( cmdLine );
错误:
error: unknown switch `n'
usage: git status [options] [--] <filepattern>...
【问题讨论】: