From mboxrd@z Thu Jan 1 00:00:00 1970 From: OSiUX Subject: Re: bash alias and history in code block Date: Fri, 6 Dec 2013 17:16:30 -0300 Message-ID: <20131206201630.GA1067@localhost> References: <20131206175855.GA32108@localhost> <864n6lokbj.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="opJtzjQTFsWo+cga" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:32916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp1oR-0005PO-0L for emacs-orgmode@gnu.org; Fri, 06 Dec 2013 15:15:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vp1oM-0007Zi-Dp for emacs-orgmode@gnu.org; Fri, 06 Dec 2013 15:15:46 -0500 Received: from merlot.gcoop.coop ([67.208.113.123]:38210) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vp1oL-0007ZR-M8 for emacs-orgmode@gnu.org; Fri, 06 Dec 2013 15:15:42 -0500 Received: from localhost (merlot [127.0.0.1]) (Authenticated sender: xuiso@osiux.com.ar) by merlot.gcoop.coop (Postfix) with ESMTPSA id 2FC8A1480F3 for ; Fri, 6 Dec 2013 17:16:04 -0300 (ART) Content-Disposition: inline In-Reply-To: <864n6lokbj.fsf@somewhere.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --opJtzjQTFsWo+cga Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable El vie, 06 dic 2013, Sebastien Vauban dec=C3=ADa: > 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=3D%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=3D%Y-%m-%d %H:%M 4.2.37(1)-release history on 8275 44194 338107 alias dia=3D'date +%Y-%m-%d' alias hh=3D'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 --opJtzjQTFsWo+cga Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBAgAGBQJSojCdAAoJELMIpnGSN9NsSYkQAKFSy+gtR8d+xqeWjoq1OTjm MyphKyK3gj73slK8ycEXWx4hrKaxqizT7DapSWgSwDLyqS86GUdOc8Fydozz4cBh 01Q5zSGRd7VebroDn1DSIwjPdAWOHYj69GJVeN6J9pa+FHECZ7OaSzchjXJqlAXv enhfhkReGLA/ZYnLRFqsoKoQy/auBrVNttvSjC1LrT3Ypts/wfnSMb26qrjrUxDv OByqUAW+6p2oSN5RMFtWOZT6EtGHsoU3Os4EzKT09DmDBx+7PyHDqb+LMOj1yNbW XLuCUBLhf/prpGvJZqqXyre9U4KgraN36bBpo8U5795sShsrifvslDkVPeb6rea4 YTJXjtd0wEIz2uAaXzQm1rvtZIT96sOx3CS1L8FHdvYX/Qla+12H+U5RmQ90aiVh PEJjqVgQy7oHHrWlp7lVqjrsvbR1krAUUtPidzJdDg0kkyWD6Al2xFzZPvHFkYt7 ucAl4BjzyvRh3cwwVuv4VAA1q3Xi8THy/f6eNH5AACUnlc73mVTdPPk4Qyi1KD+7 Wkp58E+8EEuboBT/TaU+bDYyVqudjlXyt20hTN7OuKFxSL7P0DDAcDi152JhWOkw KH5xpwgrEsH//3UGDP25eFBAICs1026/EnKRJpujOMqqLHWPXkXIDqZgOtmRkZxL upWu9nd+upYqc78efZ2l =ctE8 -----END PGP SIGNATURE----- --opJtzjQTFsWo+cga--