emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: OSiUX <xuiso@osiux.com.ar>
To: emacs-orgmode@gnu.org
Subject: Re: bash alias and history in code block
Date: Fri, 6 Dec 2013 17:16:30 -0300	[thread overview]
Message-ID: <20131206201630.GA1067@localhost> (raw)
In-Reply-To: <864n6lokbj.fsf@somewhere.org>

[-- Attachment #1: Type: text/plain, Size: 2013 bytes --]

El vie, 06 dic 2013, Sebastien Vauban decía:

> OSiUX wrote:
> > 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
>
> Just throwing an idea (as I don't know enough about that): play with the
> variable `org-babel-sh-command' (default: "bash") and add options such as
> "--login" or "--interactive" (or stuff like that)?

Ok, add a "bash -i" and now is working well:

   #+BEGIN_SRC sh :session :results output
     grep bash ~/.emacs
     echo $SHELL
     echo $HOME
     alias | wc
     env | grep HISTTIMEFORMAT
     echo $BASH_VERSION
     shopt -s histappend
     set -o | grep history
     history | wc
     alias dia
     alias hh
     hh | tail
     history -a
   #+END_SRC

   #+RESULTS:
   #+begin_example
   (setq org-babel-sh-command "bash -i")
   /bin/bash
   /home/osiris
       534    3236   29894
   HISTTIMEFORMAT=%Y-%m-%d %H:%M
   4.2.37(1)-release
   history          on
      8275   44194  338107
   alias dia='date +%Y-%m-%d'
   alias hh='history | egrep $(dia)  | cut -c 19- | sort -u'
   17:10 set -o | grep history
   17:10 shopt -s histappend
   17:10 ssh sugar-mant
   17:10 sudo chown osiris.osiris config -R
   17:10 sudo chown osiris.osiris .* -R
   17:10 sudo chown osiris.osiris /var/run/screen/S-osiris
   17:10 sudo chown osiris.osiris /var/run/screen/S-osiris.*
   17:10 sudo -s
  #+end_example

Sometimes I forget to start clock in a task,
then I use the history to know the timestamp
:-P

--

::

  Osiris Alejandro Gomez (OSiUX) osiux@osiux.com.ar
  DC44 95D2 0D5D D544 FC1A F00F B308 A671 9237 D36C
  http://www.osiux.com.ar http://www.altermundi.net

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2013-12-06 20:15 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
2013-12-06 19:23 ` Sebastien Vauban
2013-12-06 20:16   ` OSiUX [this message]

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=20131206201630.GA1067@localhost \
    --to=xuiso@osiux.com.ar \
    --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).