更新时间:2023-12-04 09:51:58
问题是Runtime.exec()不理解shell概念,例如|。而是尝试:
The issue is that Runtime.exec() does not understand shell concepts such as "|". Instead try:
Runtime.getRuntime().exec("/bin/sh", "-c", co);
问题是exec直接运行二进制文件而不调用shell。 |字符只能由shell识别,而不是由sox识别。 -c告诉shell运行单个命令,并将整个命令作为单个参数传递。
The problem is that exec runs a binary directly without invoking the shell. The "|" character is only recognized by the shell, not by sox. The "-c" tells the shell to run a single command, and passes the entire command as the single argument.