env SSH_AUTH_SOCK=$SSH_AUTH_SOCK inner_script.sh #### my $command="rdist $RDIST_OPTIONS"; open(RDIST, "$command 2>&1 |" ) || die("$basename: Unable to open $command\n"); my $errorcount = 0; while ( ) { ... some other commands/conditional statements ... }