$ a=foo b=bar; export a b; perl -le 'exists $ENV{a} && exists $ENV{b} ? exit 0 : exit 1'; echo "exit status: $?" exit status: 0