Re: pipe and resend mail. was [noob question on filtering and sending mail to bdd or rest request]

2016-12-22 Thread Stéphane MERLE
Hi Viktor, I though I new a little of bash but in fact no ... you're a bash king ! if I understood it well : first, I save the message in the file descriptor 3 msg=$(mktemp /tmp/msg.XX) || exit 75 cat > $msg || { rm $msg; exit 75; } exec 3< $msg || { rm $msg; exit 75; } rm $

Re: pipe and resend mail. was [noob question on filtering and sending mail to bdd or rest request]

2016-12-22 Thread Viktor Dukhovni
> On Dec 22, 2016, at 3:51 AM, Stéphane MERLE > wrote: > > First, I save the message in the file descriptor 3 > >msg=$(mktemp /tmp/msg.XX) || exit 75 >cat > $msg || { rm $msg; exit 75; } >exec 3< $msg || { rm $msg; exit 75; } >rm $msg > > then I use it by rewinding it : >

Re: pipe and resend mail. was [noob question on filtering and sending mail to bdd or rest request]

2016-12-22 Thread Wietse Venema
Viktor Dukhovni: > > > On Dec 22, 2016, at 3:51 AM, St?phane MERLE > > wrote: > > > > First, I save the message in the file descriptor 3 > > > >msg=$(mktemp /tmp/msg.XX) || exit 75 > >cat > $msg || { rm $msg; exit 75; } > >exec 3< $msg || { rm $msg; exit 75; } > >rm $msg >

Re: pipe and resend mail. was [noob question on filtering and sending mail to bdd or rest request]

2016-12-22 Thread Viktor Dukhovni
> On Dec 22, 2016, at 12:36 PM, Wietse Venema wrote: > >> # Final command. Shell will remove the temp file and exit with >> # Sendmail's exit code. >> /usr/sbin/sendmail "$@" > > And do not forget the '--' in > pipe ... argv=/path/to/script -f ${sender} -- ${recipient} And the

Re: pipe and resend mail. was [noob question on filtering and sending mail to bdd or rest request]

2016-12-22 Thread Viktor Dukhovni
On Dec 22, 2016, at 12:36 PM, Wietse Venema wrote: # Final command.  Shell will remove the temp file and exit with # Sendmail's exit code. /usr/sbin/sendmail "$@"And do not forget the '--' inpipe ... argv=/path/to/script -f ${sender} -- ${recipient}And the missing "< $msg" in the final command: /u