我希望 Apache Commons-exec 运行:
混帐状态 | 头-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>...