emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Redirecting stderr to stdout with babel/shell


From: Karl Voit
Subject: Re: [O] Redirecting stderr to stdout with babel/shell
Date: Sun, 11 Jan 2015 16:02:46 +0100
User-agent: slrn/pre1.0.0-18 (Linux)

* Achim Gratz <address@hidden> wrote:
> Karl Voit writes:
>> echo "testing stderr with manual redirect" 2>&1 >&2
>
> The last redirection ">&2" is nonsense, it only works because STDERR is
> already reopened on STDOUT and redirection to the same file descriptor
> is ignored.

Absolutely right. Must have been a non-deleted artefact after I
tested something different in that line.

> And to solve your original problem:
>
> #+BEGIN_SRC sh :results output
> exec 2>&1
> echo "testing stdout" >&1
> echo "testing stderr" >&2
> date -g
> :
> #+END_SRC

Together with the '{ ... } 2>&1' trick, this is a valid workaround.
What I wanted to achieve is a re-direct of any (sh) babel script
without this exec-command I do have to add.

However, I could imagine an additional babel-parameter like ":stderr
redirect" (or something more meaningful) because in most cases I
have to add the ":results output" line as well.

-- 
mail|git|SVN|photos|postings|SMS|phonecalls|RSS|CSV|XML to Org-mode:
       > get Memacs from https://github.com/novoid/Memacs <

https://github.com/novoid/extract_pdf_annotations_to_orgmode + more on github




reply via email to

[Prev in Thread] Current Thread [Next in Thread]