我正在尝试从Java代码创建一个Shell脚本。我正在使用以下方法创建Shell脚本。
String cmd = "echo -e \"echo -e abc\\\0177\\\0177\\\0177\\\0177\\\0177\\\0177\\\0177\\\0177\" > ";
String [] commands = { "/system/bin/sh", "-c", cmd + "script.sh " };
Runtime.getRuntime().exec(commands);
然而,当我打开script.sh文件时,我看到以下内容:
echo -e abc\*7\*7\*7\*7\*7\*7\*7\*7
我想要的是下面这个:
。
echo -e "abc\0177\0177\0177\0177\0177\0177\0177\0177"
我做错了什么?有什么想法可以解决这个问题吗?
*
字符吗?我得到了其他一些字符(并不真正可见的字符)。再说了,我没有 "/system/bin",所以我使用了 "/bin/bash"。/system/bin/sh
是什么 shell?那是什么操作系统? - RealSkeptic