This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Single quotes inside here document


Hi Tobias,

First, thanks for your very quick response...

tobias schlottke wrote:
>> I try to run the following script on the latest Cygwin (updated yesterday) on
>> Windows XP SP3:
>>
>> --8<---------------cut here---------------start------------->8---
>> data=$(cat<<'EOF'
>> Date valeur;Reference de l'operation;Description;Montant de l'operation;Devise;Date d'operation;Compte de contrepartie;Nom de la contrepartie :;Communication 1 :;Communication 2 :
>> 04-06-2009;A9F04NT01WK300TG;Virem. internet;420,00;EUR;04-06-2009;799-5900947-23;PAYEE ONE; ;
>> 24-02-2009;A9B24NT012K4018Z;Virem. internet;-54,93;EUR;24-02-2009;799-9974005-30;ME;Eigen rekening;
>> 18-05-2008;A8E19NT000S604QI;Virem. internet;-1.000,00;EUR;19-05-2008;799-8068445-18;PAYEE TWO; ;
>> EOF
>> )
>> echo "$data"
>> --8<---------------cut here---------------end--------------->8---
>
> What type of shell do you use?

GNU bash, version 3.2.51(24)-release (i686-pc-cygwin)
Copyright (C) 2007 Free Software Foundation, Inc.

> If I use bash and the 'plain old' syntax, it works:
>
> data=`cat <<EOF
> .....
> EOF
> `
> echo $data

The following:

--8<---------------cut here---------------start------------->8---
data=`cat <<'BABEL_STRING'
Date valeur;Reference de l'operation;Description;Montant de l'operation;Devise;Date d'operation;Compte de contrepartie;Nom de la contrepartie :;Communication 1 :;Communication 2 :
04-06-2009;A9F04NT01WK300TG;Virem. internet;420,00;EUR;04-06-2009;799-5900947-23;PAYEE ONE; ; 
24-02-2009;A9B24NT012K4018Z;Virem. internet;-54,93;EUR;24-02-2009;799-9974005-30;ME;Eigen rekening; 
18-05-2008;A8E19NT000S604QI;Virem. internet;-1.000,00;EUR;19-05-2008;799-8068445-18;PAYEE TWO; ;
BABEL_STRING
`
echo "$data" | grep PAYEE
--8<---------------cut here---------------end--------------->8---

does indeed work exactly as I need it:

--8<---------------cut here---------------start------------->8---
04-06-2009;A9F04NT01WK300TG;Virem. internet;420,00;EUR;04-06-2009;799-5900947-23;PAYEE ONE; ;
18-05-2008;A8E19NT000S604QI;Virem. internet;-1.000,00;EUR;19-05-2008;799-8068445-18;PAYEE TWO; ;
--8<---------------cut here---------------end--------------->8---

Thank you VERY MUCH!

BTW, is it a bug, then, that the new syntax *does not* work?  I can't believe
I'm the first one facing this.

> Or do you need backtics as well?

Nope. Don't need backtics. You're my savvier...

Though, please note that I well need the double quotes around "$data".
Otherwise, the above code (with echo $data | grep PAYEE) returns:

--8<---------------cut here---------------start------------->8---
Date valeur;Reference de l'operation;Description;Montant de l'operation;Devise;Date d'operation;Compte de contrepartie;Nom de la con
trepartie :;Communication 1 :;Communication 2 : 04-06-2009;A9F04NT01WK300TG;Virem. internet;420,00;EUR;04-06-2009;799-5900947-23;PAY
EE ONE; ; 24-02-2009;A9B24NT012K4018Z;Virem. internet;-54,93;EUR;24-02-2009;799-9974005-30;ME;Eigen rekening; 18-05-2008;A8E19NT000S
604QI;Virem. internet;-1.000,00;EUR;19-05-2008;799-8068445-18;PAYEE TWO; ;
--8<---------------cut here---------------end--------------->8---

Best regards,
  Fabrice Niessen

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]