OSiUX <xu...@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