From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Welle Subject: Re: How to let ob-shell to download file and get result as a link to file? Date: Mon, 26 Mar 2018 20:06:21 +0200 Message-ID: <87zi2u90f6.fsf@luisa.c0t0d0s0.de> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f0WVq-0006Gw-0w for emacs-orgmode@gnu.org; Mon, 26 Mar 2018 14:06:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f0WVm-00025T-SX for emacs-orgmode@gnu.org; Mon, 26 Mar 2018 14:06:30 -0400 Received: from mout.gmx.net ([212.227.17.20]:34929) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f0WVm-000258-Im for emacs-orgmode@gnu.org; Mon, 26 Mar 2018 14:06:26 -0400 Received: from stella.c0t0d0s0.de ([89.204.153.12]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0LsgvV-1eXpbl2CNt-012L5v for ; Mon, 26 Mar 2018 20:06:24 +0200 Received: from Stella (stella.c0t0d0s0.de [192.168.42.1]) by stella.c0t0d0s0.de (Postfix) with ESMTP id 2180CC4080 for ; Mon, 26 Mar 2018 20:06:21 +0200 (CEST) In-Reply-To: (stardiviner's message of "Mon, 26 Mar 2018 23:35:17 +0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Hello, stardiviner writes: > I tried the following example: > > ``` > > #+begin_src shell :mkdir yes :dir "data/tmp" :results file :file > "crackzor_1.0.c.gz" > wget -c "http://ben.akrin.com/crackzor/crackzor_1.0.c.gz" > #+end_src > > #+RESULTS: > [[file:data/tmp/crackzor_1.0.c.gz]] > ``` > > But the files is empty, I check out Org-mode document about `:file` > header argument, seems org-babel will write result to `:file` specified > file. I wander how I can handle upper case correctly? (don't write > result to file, just insert a link to downloaded file as a result) well, your above example would work, at least to a certain point, if you let wget write its output to stdout: #+begin_src sh :mkdir yes :dir "/tmp" :results file :file "crackzor_1.0.c.gz" wget -c "http://ben.akrin.com/crackzor/crackzor_1.0.c.gz" -O- #+end_src But I don't now know how to get the encoding right (I think that's the problem). The zip file contains rubbish. What I would do instead is something like this: #+begin_src sh :mkdir yes :dir "/tmp" :results raw :var fn="crackzor_1.0.c.gz" /usr/bin/wget -c "http://ben.akrin.com/crackzor/${fn}" echo "[[file:/tmp/${fn}]]" #+end_src Regards hmw