<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Improving command line efficiency via Bash history</title>
	<atom:link href="http://dancingpenguinsoflight.com/2008/12/improving-command-line-efficiency-via-bash-history/feed/" rel="self" type="application/rss+xml" />
	<link>http://dancingpenguinsoflight.com/2008/12/improving-command-line-efficiency-via-bash-history/</link>
	<description></description>
	<lastBuildDate>Thu, 09 Feb 2012 14:28:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Peter Burdick</title>
		<link>http://dancingpenguinsoflight.com/2008/12/improving-command-line-efficiency-via-bash-history/comment-page-1/#comment-56326</link>
		<dc:creator>Peter Burdick</dc:creator>
		<pubDate>Sun, 17 Jul 2011 04:37:16 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=365#comment-56326</guid>
		<description>You can try the code below found here - didn&#039;t try it but it looks promising:
&lt;a href=&quot;http://stackoverflow.com/questions/5460923/run-bash-built-in-commands-in-python&quot; title=&quot;stackoverflow post&quot; rel=&quot;nofollow&quot;&gt;run BASH built-in commands in Python

&lt;code&gt;
from subprocess import Popen, PIPE, STDOUT
shell_command = &#039;bash -i -c &quot;history -r; history&quot;&#039;
event = Popen(shell_command, shell=True, stdin=PIPE, stdout=PIPE, 
    stderr=STDOUT)
output = event.communicate()
</description>
		<content:encoded><![CDATA[<p>You can try the code below found here &#8211; didn&#8217;t try it but it looks promising:<br />
<a href="http://stackoverflow.com/questions/5460923/run-bash-built-in-commands-in-python" title="stackoverflow post" rel="nofollow">run BASH built-in commands in Python</p>
<p><code><br />
from subprocess import Popen, PIPE, STDOUT<br />
shell_command = 'bash -i -c "history -r; history"'<br />
event = Popen(shell_command, shell=True, stdin=PIPE, stdout=PIPE,<br />
    stderr=STDOUT)<br />
output = event.communicate()</code></a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Huckins</title>
		<link>http://dancingpenguinsoflight.com/2008/12/improving-command-line-efficiency-via-bash-history/comment-page-1/#comment-658</link>
		<dc:creator>Samuel Huckins</dc:creator>
		<pubDate>Mon, 16 Feb 2009 14:16:37 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=365#comment-658</guid>
		<description>@Hugo: I am on the fence about where to put this function. Right now I keep it in my ~/.bashrc. If it were any longer, I would likely pull it out into my directories of personal scripts, symlinked somewhere system-appropriate.

The alias commands I would definitely keep in ~/.bashrc, so that all my defined aliases are in one intuitive place.</description>
		<content:encoded><![CDATA[<p>@Hugo: I am on the fence about where to put this function. Right now I keep it in my ~/.bashrc. If it were any longer, I would likely pull it out into my directories of personal scripts, symlinked somewhere system-appropriate.</p>
<p>The alias commands I would definitely keep in ~/.bashrc, so that all my defined aliases are in one intuitive place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugo Heden</title>
		<link>http://dancingpenguinsoflight.com/2008/12/improving-command-line-efficiency-via-bash-history/comment-page-1/#comment-655</link>
		<dc:creator>Hugo Heden</dc:creator>
		<pubDate>Mon, 16 Feb 2009 11:28:10 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=365#comment-655</guid>
		<description>Lovely!

Rookie question, sorry:

Do you suggest to put that function in ~/.bashrc ? Or rather as a separate script in ~/bin ?

And the what about the *alias* commands?</description>
		<content:encoded><![CDATA[<p>Lovely!</p>
<p>Rookie question, sorry:</p>
<p>Do you suggest to put that function in ~/.bashrc ? Or rather as a separate script in ~/bin ?</p>
<p>And the what about the *alias* commands?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Samuel Huckins</title>
		<link>http://dancingpenguinsoflight.com/2008/12/improving-command-line-efficiency-via-bash-history/comment-page-1/#comment-396</link>
		<dc:creator>Samuel Huckins</dc:creator>
		<pubDate>Mon, 29 Dec 2008 20:44:17 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=365#comment-396</guid>
		<description>I wanted to steer clear of just using .bash_history because that doesn&#039;t take into account the format and other options declared in .bashrc and .bash_profile, as the history builtin does. So if you filter out certain commands, or do anything else custom, the file won&#039;t reflect that, which seemed sub-optimal to me.</description>
		<content:encoded><![CDATA[<p>I wanted to steer clear of just using .bash_history because that doesn&#8217;t take into account the format and other options declared in .bashrc and .bash_profile, as the history builtin does. So if you filter out certain commands, or do anything else custom, the file won&#8217;t reflect that, which seemed sub-optimal to me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anonim</title>
		<link>http://dancingpenguinsoflight.com/2008/12/improving-command-line-efficiency-via-bash-history/comment-page-1/#comment-395</link>
		<dc:creator>anonim</dc:creator>
		<pubDate>Mon, 29 Dec 2008 20:07:10 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=365#comment-395</guid>
		<description>Sorry but I managed to blow the post, here we go again:

import os

def do_history():
    h = open(&#039;%s/.bash_history&#039; % os.environ[&#039;HOME&#039;])
    counter = 0
    for line in h.readlines():
        counter += 1
        print counter, line.replace(&#039;\n&#039;,&#039;&#039;)

if __name__ == &#039;__main__&#039;:
    do_history()</description>
		<content:encoded><![CDATA[<p>Sorry but I managed to blow the post, here we go again:</p>
<p>import os</p>
<p>def do_history():<br />
    h = open(&#8216;%s/.bash_history&#8217; % os.environ['HOME'])<br />
    counter = 0<br />
    for line in h.readlines():<br />
        counter += 1<br />
        print counter, line.replace(&#8216;\n&#8217;,&#8221;)</p>
<p>if __name__ == &#8216;__main__&#8217;:<br />
    do_history()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anonim</title>
		<link>http://dancingpenguinsoflight.com/2008/12/improving-command-line-efficiency-via-bash-history/comment-page-1/#comment-394</link>
		<dc:creator>anonim</dc:creator>
		<pubDate>Mon, 29 Dec 2008 20:05:15 +0000</pubDate>
		<guid isPermaLink="false">http://dancingpenguinsoflight.com/?p=365#comment-394</guid>
		<description>AFAIK history just prints the contents of ~/.bash_history and it&#039;s line number, so you could write that in python, a very quick and dirty solution:

import os

def do_history():
    h = open(&#039;%s/.bash_history&#039; % os.environ[&#039;HOME&#039;])
    counter = 0
    for line in h.readlines():
        counter += 1
        print counter, #!/usr/bin/python                                                                                                                                                                  
import os

def do_history():
    h = open(&#039;%s/.bash_history&#039; % os.environ[&#039;HOME&#039;])
    counter = 0
    for line in h.readlines():
        counter += 1
        print counter, line.replace(&#039;\n&#039;,&#039;&#039;)

if __name__ == &#039;__main__&#039;:
    do_history()</description>
		<content:encoded><![CDATA[<p>AFAIK history just prints the contents of ~/.bash_history and it&#8217;s line number, so you could write that in python, a very quick and dirty solution:</p>
<p>import os</p>
<p>def do_history():<br />
    h = open(&#8216;%s/.bash_history&#8217; % os.environ['HOME'])<br />
    counter = 0<br />
    for line in h.readlines():<br />
        counter += 1<br />
        print counter, #!/usr/bin/python<br />
import os</p>
<p>def do_history():<br />
    h = open(&#8216;%s/.bash_history&#8217; % os.environ['HOME'])<br />
    counter = 0<br />
    for line in h.readlines():<br />
        counter += 1<br />
        print counter, line.replace(&#8216;\n&#8217;,&#8221;)</p>
<p>if __name__ == &#8216;__main__&#8217;:<br />
    do_history()</p>
]]></content:encoded>
	</item>
</channel>
</rss>

