Re: problem with \n and variables in bash script
On Tue, 2002-10-15 at 17:27, Iñaki Martínez wrote:
>
> HI!!!!
>
>
> I have this bash script:
>
> #!/bin/bash
>
> --------------------------------------------------------------------------------
>
> SALIDA=$(diff file1 file2)
>
> if [ $? == 1 ]
> then
> echo -e $SALIDA | mail -s variable my_email
> diff file1 file2 | mail -s directly my_email
> fi
>
> --------------------------------------------------------------------------------
>
> Well, when i get the emails, the one with subject "variable" it is in ONE line
> but the one with subject "directly" is display correctly.
>
>
> So my question is how to get \n processed with variables.
You need to set the IFS variable. Read 'man bash'. Just put
IFS=' \t'
at the front of your script. (no need for the -e switch to echo then)
--
Claudio Bley ASCII ribbon campaign (")
Debian GNU/Linux advocate - against HTML email X
http://www.cs.uni-magdeburg.de/~bley/ & vCards / \
Reply to: