From: Eric Schulte <schulte.eric@gmail.com>
To: OSiUX <xuiso@osiux.com.ar>
Cc: emacs-orgmode@gnu.org
Subject: Re: bash alias and history in code block
Date: Fri, 06 Dec 2013 11:34:31 -0700 [thread overview]
Message-ID: <87txel6b40.fsf@gmail.com> (raw)
In-Reply-To: 20131206175855.GA32108@localhost
OSiUX <xuiso@osiux.com.ar> writes:
> How to use alias and bash builtin functions?
>
> #+BEGIN_SRC sh :session :results output
> echo $SHELL
> echo $HOME
> source ~/.bashrc
> alias | wc
> env | grep HISTTIMEFORMAT
> history | wc
> #+END_SRC
>
> #+RESULTS:
> : /bin/bash
> : /home/osiris
> : 0 0 0
> : HISTTIMEFORMAT=%Y-%m-%d %H:%M
> : 0 0 0
>
> Thanks!
>
I get the following. Note that I define my alia in a separate file
which I had to load explicitly for the alia to be defined (it should be
sourced from my ~/.bashrc, but shells can be weird about loading things
they think might be profile related when you're not logging in).
#+BEGIN_SRC sh :session :results output
echo $SHELL
echo $HOME
source ~/.bashrc
alias | wc
env | wc
history | wc
#+END_SRC
#+RESULTS:
: /bin/zsh
: /home/eschulte
: 0 0 0
: 28 28 715
: 0 0 0
#+BEGIN_SRC sh :session :results output
echo $SHELL
echo $HOME
source ~/.alia
source ~/.bashrc
alias | wc
env | wc
history | wc
#+END_SRC
#+RESULTS:
: /bin/zsh
: /home/eschulte
: 19 99 814
: 28 28 715
: 0 0 0
My guess with the empty history is that bash can tell it isn't an
interactive session, which you might be able to fake with tty pipe STDIN
and STDOUT nonsense in ob-sh. But in general I don't see the utility of
history in a code block.
Best,
--
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D
next prev parent reply other threads:[~2013-12-06 19:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-06 17:58 bash alias and history in code block OSiUX
2013-12-06 18:34 ` Eric Schulte [this message]
2013-12-06 19:23 ` Sebastien Vauban
2013-12-06 20:16 ` OSiUX
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87txel6b40.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=xuiso@osiux.com.ar \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.