delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/01/18/04:14:00

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=2.5 required=5.0 tests=BAYES_50,RDNS_DYNAMIC,TVD_RCVD_IP
X-Spam-Check-By: sourceware.org
From: "Fabrice Niessen" <fni AT missioncriticalit DOT com>
To: tobias schlottke <tobias DOT schlottke AT secu DOT lu>
Cc: cygwin AT cygwin DOT com
Subject: Re: Single quotes inside here document
References: <807he2fysk DOT fsf AT missioncriticalit DOT com> <4D3547C4 DOT 9080205 AT secu DOT lu>
X-Archive: encrypt
Date: Tue, 18 Jan 2011 10:13:06 +0100
In-Reply-To: <4D3547C4.9080205@secu.lu> (tobias schlottke's message of "Tue, 18 Jan 2011 08:56:52 +0100")
Message-ID: <80vd1mefrx.fsf@missioncriticalit.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt)
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019