#!/bin/bash while read command ; do rsh $command snapmirror status done &1 | mail foo@example.com #### #!/usr/bin/perl use strict; use warnings; open IN, "<", "netapps" || die "Can't open file"; my $output = ''; while () { chomp; $output .= qx( rsh $_ snapmirror status 2>&1 ); }