On Sun, 2014-06-15 at 09:34 +0200, Ralf Mardorf wrote: > On Sun, 2014-06-15 at 09:10 +0200, Ralf Mardorf wrote: > > On Sun, 2014-06-15 at 01:46 -0400, [email protected] 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 > [email protected] && echo $? > 0 > [rocketmouse@archlinux ~]$
Resp. here: [rocketmouse@archlinux ~]$ cat .msmtp.mail/fraud.mail | msmtp -a default [email protected] && RETVAL=$?; echo $RETVAL 0 [rocketmouse@archlinux ~]$ OTOH I don't know for what command the exit status is, but the it at least was displayed, after everything finished. -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected] Archive: https://lists.debian.org/1402817943.3692.61.camel@archlinux

