instead of echo -e and a string, might be simpler to use a tempfile with cat
<<EOT

cat >$logmessagefile <<EOT
<your text, without any need for any escape sequences>
EOT

cat $logmessagefile >> $LOGFILE

mailx ... <$logmessagefile


On Sat, Nov 7, 2009 at 11:24 AM, Aurelian Melinte <[email protected]> wrote:

> Hello,
>
> I have an scripting "inconvenience" I could not find a solution so far. Any
> advice is appreciated.
>
> Basically, I am capturing the output of a program and I am losing the
> newlines in the process. I would like to keep them though, otherwise the
> output is hard to read.
>
>
> Here are the relevant lines:
>
>     rcsdiffmsg=$(/usr/bin/rcsdiff $targetfile)
>     cimsg=$(/bin/echo -e  "$logmsg" | /usr/bin/ci -l $targetfile 2>&1)
>
>     logmsg="\n
> #-------------------------------------------------------\n
> Date:   `/bin/date`\n
> File:   $filepath [$1]\n
> Pwd:    `pwd`\n
> $logmsg\n
> \n
> $cimsg\n
> \n
> $rcsdiffmsg\n
> #-------------------------------------------------------\n
> "
>
>     /bin/echo -e $logmsg >> $LOGFILE
>     /bin/echo -e $logmsg | /usr/bin/mailx root -s "Change to: $filepath
> [$1]"
>
>
> And the result, from either the file or email:
>
>  /avi.store/sbin/avi.sh,v <-- /avi.store/sbin/avi.sh new revision: 1.10;
> previous revision: 1.9 done
>
>  4c4 < # $Id: avi.sh,v 1.9 2009/11/06 01:53:01 root Exp root $ --- > # $Id:
> $ 91c91 < cimsg=`/bin/echo -e "$logmsg" | /usr/bin/ci -l $targetfile 2>&1`
> --- > cimsg=$(/bin/echo -e "$logmsg" | /usr/bin/ci -l $targetfile 2>&1)
>
>
> Thanks,
> a.
>
> _______________________________________________
> mlug mailing list
> [email protected]
> https://listes.koumbit.net/cgi-bin/mailman/listinfo/mlug-listserv.mlug.ca
>
_______________________________________________
mlug mailing list
[email protected]
https://listes.koumbit.net/cgi-bin/mailman/listinfo/mlug-listserv.mlug.ca

Reply via email to