exec 3> /tmp/out echo 'before exec' >&3 exec env2.pl echo 'after exec' >&3 exec 3>&- cat /tmp/out before exec after exec