jexec 2 /bin/sh -c "FOO=bar BAZ=quiz /usr/bin/env | /usr/bin/grep -E '(FOO|BAZ)'" # and yes jexec should have something integrated IMO thanks to Bazerka.