<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>mcBachmann.de TechBlog &#187; acpi</title>
	<atom:link href="http://blog.mcbachmann.de/tag/acpi/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.mcbachmann.de</link>
	<description>Der Blog zur Website ;-)</description>
	<lastBuildDate>Mon, 06 Sep 2010 13:11:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>[Bash] Remaining Battery Power as Prompt</title>
		<link>http://blog.mcbachmann.de/linux/bash-remaining-battery-power-as-prompt</link>
		<comments>http://blog.mcbachmann.de/linux/bash-remaining-battery-power-as-prompt#comments</comments>
		<pubDate>Mon, 14 Apr 2008 19:08:43 +0000</pubDate>
		<dc:creator>Sven Bachmann</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[acpi]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://blog.mcbachmann.de/?p=180</guid>
		<description><![CDATA[Hi,
as seen at my pal Philipp, I also wanted to see the current battery power in the bash prompt. So here is a script which works fine on my X60s.
    #!/bin/bash
    REMAIN=`grep "remaining capacity" /proc/acpi/battery/BAT0/state &#124; sed 's/remaining capacity:\(.*\)mWh/\1/'`
    FULL=`grep "last full capacity" /proc/acpi/battery/BAT0/info &#124; sed [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,</p>
<p>as seen at my pal Philipp, I also wanted to see the current battery power in the bash prompt. So here is a script which works fine on my X60s.</p>
<blockquote><p><code>    #!/bin/bash</p>
<p>    REMAIN=`grep "remaining capacity" /proc/acpi/battery/BAT0/state | sed 's/remaining capacity:\(.*\)mWh/\1/'`<br />
    FULL=`grep "last full capacity" /proc/acpi/battery/BAT0/info | sed 's/last full capacity:\(.*\)mWh/\1/'`</p>
<p>    echo $[ $REMAIN * 100 / $FULL ]</code></p></blockquote>
<p>Just save it for example in your home directory as bat.sh and make it executable with &#8216;chmod +x bat.sh&#8217;. Then edit the .bashrc file in your home dir and add the following line at the end:</p>
<blockquote><p><code>    PS1='[`~/bat.sh`%] \W> '</code></p></blockquote>
<p>The \W is some preference from me, to see only the directory I&#8217;m currently in and not the whole path.</p>
<p>Bye<br />
  Sven</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mcbachmann.de/linux/bash-remaining-battery-power-as-prompt/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
