I usually use "ps -ax | grep java" in a terminal to know the "java programs" running on my PI.
I try to use it inside a B4J program with a shell command
shl.Initialize("shl", "/bin/bash", Array As String("ps","-ax", "|", "grep","java"))
Execution was successful but "StdOut" was empty.
I asked to ChatGPT who answered that pipes are not allowed in shell commands
And then ChatGPT recommands to use following command
shl.Initialize("shl", "/bin/bash", Array As String("/bin/bash", "-c", "ps","-ax", "|", "grep","java"))
ChatGPT explains that the original command "ps -ax | grep java" is now "enveloped" in a command "/bin/bash -c".
Anyway, Stdout remains empty !
I guess that there is people in this forum better than ChatGPT who can say how it is easy to get the response of a simple bash command ?
I join my demo program for testing.