On Wed, 31 Aug 2005 11:24:45 +0300, David Harel
<hare...@ergolight-sw.com> wrote:
>
> Hi all,
> I really am ashame to ask this question but I did not find an answer for
> it in any documentation I searched (I have serious doubts bout my
> searching skills).
>
> Here is a script fragment.
> ---------------------------
> #!/bin/bash
>
> subject='Set UID program scan results'
> address="hare...@ergolight-sw.com"
> mailcommand="mutt $address -s $subject"
>
> $mailcommand << okfff
> Some message body.
>
> okfff
> ---------------------------
The way to overcome this is to use the IFS environment variable.
subject='Set UID program scan results'
address="hare...@ergolight-sw.com"
mailcommand="mutt/$address/-s/$subject" ## space replaced by /
IFS="/" ## use / as word separator
$mailcommand << okfff
Some message body.
okfff
Of course you can use any other character that is not in your text
(e.g ~, =, :, %) but do not try to use characters with shell meaning
(e.g. (, ), [, ], <, >, ;, *).
Ehud.
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry
=============================================================
From: Ariel Biener <ar...@post.tau.ac.il>
Date: Aug 31, 2005 2:06 PM
Subject: Re: A stupid bash quote question.
To: eh...@unix.mvs.co.il
Cc: hare...@ergolight-sw.com, linu...@linux.org.il
On Wednesday 31 August 2005 12:27, Ehud Karni wrote:
> > ---------------------------
> > #!/bin/bash
> >
> > subject='Set UID program scan results'
> > address="hare...@ergolight-sw.com"
> > mailcommand="mutt $address -s $subject"
> >
> > $mailcommand << okfff
> > Some message body.
> >
> > okfff
> > ---------------------------
>
One other way is:
cat <<EOD | $mailcommand
However, the whole $mailcommand idea here is useless, I 'd do (by the way, why
use mutt as a command line mail sender ? I'd use /bin/mail).
#!/bin/bash
subject="`/some/setuid/program/runs/here`"
mailaddr="hare...@ergolight-sw.com"
mailcmd=/usr/bin/mutt
cat <<EOF | $mailcmd $mailaddr -s "$subject"
blah blah
blah blah
EOF
exit 0
Ariel Biener
e-mail: ar...@post.tau.ac.il
PGP: http://www.tau.ac.il/~ariel/pgp.html
--
Cheers,
Maxim Vexler (hq4ever).
Do u GNU ?