I'm trying to run a linux command (with pipes)
using something like:
Runtime.getRuntime().exec("rpm -qa | grep "Uploader" | xargs rpm --queryformat "%{VERSION}" -q");
but i get as result only the output of the "rpm -qa"
can you help?
thanks
I'm trying to run a linux command (with pipes)
using something like:
Runtime.getRuntime().exec("rpm -qa | grep "Uploader" | xargs rpm --queryformat "%{VERSION}" -q");
but i get as result only the output of the "rpm -qa"
can you help?
thanks
Only a shell understands pipes, you can invoke the shell with the command you want to run:
exec(new String[]{"/bin/sh", "-c", "rpm -qa | grep \"Uploader\" | xargs rpm --queryformat \"%{VERSION}\" -q"});