m {
static S cmd = "ps";
static S output;
p {
output = backtick(cmd);
}
}
You might wonder how that is. It doesn't specify any command. And it immediately ends (or so it appears) after saving the output in a variable.
This is all OK in JavaX. We can set the "cmd" variable from outside, and we can also read the output variable from outside.
Why waste space in the program code for that? Seems like standard stuff - getting input from somewhere and placing your output somewhere. This should be botted. Bot-done. Automaticoned. Whatever the word is? Let's make some new words!
**
OK, as an interim measure, we do add two lines to the program to make it work:
m {
static S cmd = "ps";
static S output;
p {
output = backtick(cmd);
print("System program " + quote(shorten(cmd, 50)) + " said: " + quote(shorten(output, 50)));
sleep();
}
}
We let it sleep so it stays alive and can be inspected by a bot. (All JavaX programs have a built-in inspection feature.)
And we print a bit of info, which will end up in the system chat automatically. No need to print the whole output (which might be too long for a "normal" console) - it can be gathered by inspection at any time.
OK, and we add an example command because JavaX programs should always be runnable without parameters too. (Keeps the entertainment high!)