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
I asked to ChatGPT who answered that pipes are not allowed in shell commands
And then ChatGPT recommands to use following command
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.
I try to use it inside a B4J program with a shell command
Execution was successful but "StdOut" was empty.shl.Initialize("shl", "/bin/bash", Array As String("ps","-ax", "|", "grep","java"))
I asked to ChatGPT who answered that pipes are not allowed in shell commands
And then ChatGPT recommands to use following command
ChatGPT explains that the original command "ps -ax | grep java" is now "enveloped" in a command "/bin/bash -c".shl.Initialize("shl", "/bin/bash", Array As String("/bin/bash", "-c", "ps","-ax", "|", "grep","java"))
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.