From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: [babel] Sh problem when echo'ing input data with ' inside Date: Mon, 17 Jan 2011 13:29:15 -0700 Message-ID: <87y66ji89w.fsf@gmail.com> References: <80k4i3vgzo.fsf@missioncriticalit.com> <87k4i3uwpm.fsf@Rainer.invalid> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=38529 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pevhb-0002EO-4V for emacs-orgmode@gnu.org; Mon, 17 Jan 2011 15:29:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PevhZ-0001np-Jy for emacs-orgmode@gnu.org; Mon, 17 Jan 2011 15:29:22 -0500 Received: from mail-pz0-f41.google.com ([209.85.210.41]:63712) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PevhZ-0001nX-En for emacs-orgmode@gnu.org; Mon, 17 Jan 2011 15:29:21 -0500 Received: by pzk27 with SMTP id 27so1126914pzk.0 for ; Mon, 17 Jan 2011 12:29:20 -0800 (PST) In-Reply-To: <87k4i3uwpm.fsf@Rainer.invalid> (Achim Gratz's message of "Mon, 17 Jan 2011 21:00:37 +0100") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Achim Gratz Cc: emacs-orgmode@gnu.org Achim Gratz writes: > S=C3=A9bastien Vauban > writes: >> However, I can't do any work on the input file, the very basic echo comm= and >> already giving an error: > > This is because quoting the arguments to echo does not work when your > input contains unescaped quote characters. I've no idea how exactly > babel tries to get it's arguments to the command, but it looks like it > simply copies text and executes the resulting script? If it could open > a pipe and send the data through, no quoting would be necessary since > the shell never sees the data. I'm not sure if that's possible because > I can't find specific documentation on language "sh". > > [Note: orgmode online manual links to > http://orgmode.org/worg/org-contrib/babel/languages/ which is broken.] > yes, the Worg documentation is in dire need of maintenance, see below for discussion of how arguments are passed in the sh blocks > >> #+begin_src sh :var data=3Dexcel-from-bank :results output >> echo "$data" >> #+end_src > > So, you're using a un*xoid? This is your lucky day, since in your case y= ou > should be able to use a here script: > > #+begin_src sh :var data=3Dexcel-from-bank :results output > echo < $data > EOF > #+end_src > here scripts are how Babel sends data through to a shell script, as far as I know they should have no issues with quotes (or any other character) specifically, the following code block #+results: something #+begin_example something and something else with apostrophes ' and quotes " this should all work... #+end_example #+begin_src sh :var data=3Dsomething echo $data #+end_src Expands to #+begin_src sh data=3D$(cat <