![](/img/trans.png)
[英]How to remove this double quote before curly braces from this json string
[英]Is there a method to quote curly braces in a Java String?
我必須執行這個 Java 字符串" find ./tmp -name .SYNC -exec rm -rf {} \\;"
使用getRuntime().exec(command)
。 但它不起作用!
我想問題可能出在花括號上,因為它們以黃色突出顯示。
我已經嘗試過\\{} , \\{\\}\\ , '{}' , "'{}'"
,但沒有成功。
您可以在下面查看我的代碼。
String[] command={"find","./tmp","-name",".SYNC","-exec","rm","-rf","{}","\;" };
String res = Shell.executeCommand(command);
public static String executeCommand(String[] command){
...
p=Runtime.getRuntime().exec(command);
..
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.