Yes, here is the working example.
Note: using wait sh -c "some command >redirect"
seems to require the sh -c
part. If I try something like:
wait "ls /tmp >/tmp/xyz"
I do not get the expected results, while wait sh -c " "ls /tmp >/tmp/xyz"
is working.
example:
// command I want to run is: /usr/bin/grep -p default: /etc/security/user | egrep "histsize|min|max|retries" | egrep -v "core|admin"
wait sh -c "/usr/bin/grep -p default: /etc/security/user | egrep 'histsize|min|max|retries' | egrep -v 'core|admin' >/tmp/p0"
// indivudual commands also work, but are not required - as pipes are accepted
// wait sh -c "grep -p default: /etc/security/user > /tmp/p1"
// wait sh -c "egrep 'histsize|min|max|retries' /tmp/p1 > /tmp/p2"
// wait sh -c "egrep -v 'core|admin' /tmp/p2 >/tmp/p3"