[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: [babel] Sh problem when echo'ing input data with ' inside
From: |
Achim Gratz |
Subject: |
[Orgmode] Re: [babel] Sh problem when echo'ing input data with ' inside |
Date: |
Mon, 17 Jan 2011 22:36:11 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Achim Gratz <address@hidden> writes:
> #+begin_src sh :var data=excel-from-bank :results output
> echo <<EOF | cmd1 | cmd2
> $data
> EOF
> #+end_src
Sent too soon: use cat, not echo. Actually that is redundant, too:
#+begin_src sh :var data=excel-from-bank :results output
cmd1 <<EOF | cmd2
$data
EOF
#+end_src
Or even simpler (but that might be a bashism...):
#+begin_src sh :var data=excel-from-bank :results output
cmd1 <<<"$data" | cmd2
#+end_src
And I missed the preview in Erics post, which gave me the clue I was
looking for; the script produced by babel should actually look like
this:
#+begin_src sh
data=$(cat <<'BABEL_STRING'
Num.ro du compte :;979-9500975-24;Compte Maxi
Date valeur;R.f.rence de l'op.ration;Description;Montant de
l'op.ration;Devise;Date d'op.ration;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"
#+end_src
That is no indentation and the here-tag should be in quotes (otherwise the
here-script is subject to shell expansion). It's probably possible to
do a contrived redirection and not use a variable to store the data, but
I'm afraid I won't grok this today.
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Wavetables for the Terratec KOMPLEXER:
http://Synth.Stromeko.net/Downloads.html#KomplexerWaves
- [Orgmode] [babel] Sh problem when echo'ing input data with ' inside, Sébastien Vauban, 2011/01/17
- [Orgmode] Re: [babel] Sh problem when echo'ing input data with ' inside, Achim Gratz, 2011/01/17
- [Orgmode] Re: [babel] Sh problem when echo'ing input data with ' inside, Achim Gratz, 2011/01/18
- [Orgmode] Re: [babel] Sh problem when echo'ing input data with ' inside, Achim Gratz, 2011/01/20
- [Orgmode] Re: [babel] Sh problem when echo'ing input data with ' inside, Sébastien Vauban, 2011/01/20