On Sun, 2014-06-15 at 09:10 +0200, Ralf Mardorf wrote: > On Sun, 2014-06-15 at 01:46 -0400, david...@ling.ohio-state.edu wrote: > > > > echo "${SHUTDOWNBODY}" | mail -s "${SHUTDOWNSUBJECT}" ${EMAIL} > > > sleep 4 > > > RETVAL=$? > > > > i can't comment on the rest of the script, but you probably want > > RETVAL to be the exit status of the pipeline that sends the mail. > > making RETVAL the exit status of 'sleep 4' looks wrong to me. > > Compliment for the heads up :). > > Indeed, it's unlikely that somebody wants to know the exit status of a > sleep command and also unlikely that a sleep command will exit with > another status than 0. > > I could imagine that there is a problem. While processing mail -s there > might be a delay, but the script perhaps continues, so the OP perhaps > got the exit status of echo, since mail -s didn't finish. Maybe a && is assumed the OP doesn't add the sleep command ;) > what this problem could solve.
IOW echo "${SHUTDOWNBODY}" | mail -s "${SHUTDOWNSUBJECT}" ${EMAIL} && RETVAL=$? it at least seems to work here: [rocketmouse@archlinux ~]$ cat .msmtp.mail/fraud.mail | msmtp -a default ralf.mard...@rocketmial.com && echo $? 0 [rocketmouse@archlinux ~]$ -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/1402817672.3692.59.camel@archlinux