emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Welle <mwe012008@gmx.net>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87zi2u90f6.fsf@luisa.c0t0d0s0.de> (raw)
In-Reply-To: <e2992fef-ef84-ab42-6c70-ededa9a20f33@gmail.com> (stardiviner's message of "Mon, 26 Mar 2018 23:35:17 +0800")

Hello,

stardiviner <numbchild@gmail.com> 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

  reply	other threads:[~2018-03-26 18:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 15:35 How to let ob-shell to download file and get result as a link to file? stardiviner
2018-03-26 18:06 ` Michael Welle [this message]
2018-03-27  2:56   ` [PATCH] support insert link without write result to :file link stardiviner
2018-03-27  6:26     ` Nicolas Goaziou
2018-03-28 16:11       ` stardiviner
2018-03-28 16:23         ` Nicolas Goaziou
2018-03-29  3:39           ` stardiviner
2018-03-29 16:30             ` Berry, Charles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zi2u90f6.fsf@luisa.c0t0d0s0.de \
    --to=mwe012008@gmx.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).