<?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>Stempell &#187; bash</title>
	<atom:link href="http://stempell.com/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://stempell.com</link>
	<description>Urlaubsfotos, Fun</description>
	<lastBuildDate>Mon, 14 May 2012 09:12:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>ls soll auch die Sekunden anzeigen</title>
		<link>http://stempell.com/2011/09/ls-soll-auch-die-sekunden-anzeigen/</link>
		<comments>http://stempell.com/2011/09/ls-soll-auch-die-sekunden-anzeigen/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 08:52:43 +0000</pubDate>
		<dc:creator>Ingmar Stempell</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Work Related]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://stempell.com/?p=649</guid>
		<description><![CDATA[ls -l --time-style=+'%c ' wird zu '-rw-r--r--  1 user           group  1000  Mi 28 Sep 2011 08:43:31 UTC file' Leider gibt es keine Erklärung zur --time-style Option in der ls Manpage. Die Erklärung was mit dem % Parameter dargestellt wird, stammt aus der Man-Page von date: %c     Datum und Uhrzeit gemäß Ländereinstellung (z. B. Die [...]]]></description>
			<content:encoded><![CDATA[<p><code>ls -l --time-style=+'%c ' wird zu '-rw-r--r--  1 user           group  1000  Mi 28 Sep 2011 08:43:31 UTC file'</code></p>
<p>Leider gibt es keine Erklärung zur <code>--time-style</code> Option in der ls Manpage. Die Erklärung was mit dem % Parameter dargestellt wird, stammt aus der Man-Page von date:</p>
<p>%c     Datum und Uhrzeit gemäß Ländereinstellung (z. B. Die 23 Jan 2001 19:10:08 CET).</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://stempell.com/2011/09/ls-soll-auch-die-sekunden-anzeigen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Alle .svn Ordner löschen</title>
		<link>http://stempell.com/2010/08/alle-svn-orner-loschen/</link>
		<comments>http://stempell.com/2010/08/alle-svn-orner-loschen/#comments</comments>
		<pubDate>Thu, 26 Aug 2010 11:51:32 +0000</pubDate>
		<dc:creator>Ingmar Stempell</dc:creator>
				<category><![CDATA[Work Related]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Programmieren]]></category>

		<guid isPermaLink="false">http://stempell.com/?p=579</guid>
		<description><![CDATA[#!/bin/sh echo "recursively removing .svn folders from" pwd rm -rf `find . -type d -name .svn`]]></description>
			<content:encoded><![CDATA[<p><code><br />
#!/bin/sh<br />
echo "recursively removing .svn folders from"<br />
pwd<br />
rm -rf `find . -type d -name .svn`<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://stempell.com/2010/08/alle-svn-orner-loschen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Extract filename from path with bash</title>
		<link>http://stempell.com/2009/11/extract-filename-from-path-with-bash/</link>
		<comments>http://stempell.com/2009/11/extract-filename-from-path-with-bash/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 08:59:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://stempell.com/?p=518</guid>
		<description><![CDATA[Extract filename from path with bash command substitution. Tested and functional]]></description>
			<content:encoded><![CDATA[<p><code>x=/etc/postfix/master.cf<br />
echo ${x##*/} # = master.cf<br />
echo ${x#*.} # = cf<br />
echo ${x%.*} # = /etc/postfix/master<br />
echo ${x%/*} # = /etc/postfix</p>
<p>echo ${x/.*}|awk -F/ '{print $NF}' # = master</code></p>
]]></content:encoded>
			<wfw:commentRss>http://stempell.com/2009/11/extract-filename-from-path-with-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL DATETIME from Bash date</title>
		<link>http://stempell.com/2009/10/mysql-datetime-from-bash-date/</link>
		<comments>http://stempell.com/2009/10/mysql-datetime-from-bash-date/#comments</comments>
		<pubDate>Thu, 29 Oct 2009 09:04:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Work Related]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://stempell.com/?p=506</guid>
		<description><![CDATA[SELECT now( ) equals date +"%Y-%m-%d %H:%M:%S"]]></description>
			<content:encoded><![CDATA[<p>Just execute this:<br />
<code>$> date +"%Y-%m-%d %H:%M:%S"</code><br />
this will produce the same output as:<br />
<code> SELECT now( )</code> </p>
<p>Output: <code>2009-10-29 09:53:19</code></p>
]]></content:encoded>
			<wfw:commentRss>http://stempell.com/2009/10/mysql-datetime-from-bash-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rechnen in BASH</title>
		<link>http://stempell.com/2009/08/rechnen-in-bash/</link>
		<comments>http://stempell.com/2009/08/rechnen-in-bash/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 14:13:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Work Related]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://stempell.com/?p=464</guid>
		<description><![CDATA[How to round with bash.
printf %.0f $TEMP]]></description>
			<content:encoded><![CDATA[<p>Wehe man hat bc nicht installiert! Dann nicht weiterlesen. Du kannst sehen, ob Du bc installiert hast:</p>
<p>ls -alh /usr/bin/bc</p>
<p>Wenn es vorhanden ist, dann kann man so wunderbare Funktionen wie sqrt benutzen. Allerdings ist wieder etwas rumprobieren erforderlich, da man bc  über echo füttert.</p>
<p><code>echo $(echo "$temp" | bc )</code></p>
<p>Das Echo in der Mitte übergibt $temp an bc. Das erste echo gibt den Inhalt der Klammer aus. Statt $temp kann da auch eine wilde Rechenoperation wie sqrt($temp) o.ä. drin stehen. Besonders wichtig:<br />
Das(bc) ist die einzige Möglichkeit Fließkommazahlen / Floatingpointnumbers in der bash zu benutzen! Und weil Floatingpointnumbers im normalen Leben einer Bash keine Rolle spielen, muss man die Nachkommastelle wieder entfernen. Wie runden in der bash funktioniert, hab ich noch nicht rausgefunden, aber truncate geht mit:</p>
<p><code>TEMP=$(echo "sqrt($TARGETSIZE/($ROWS/$COLUMNS))" | bc -l)<br />
NEWCOLUMNS=$(printf %.0f $TEMP)</code></p>
<p>Die zweite Zeile ist das Entfernend er Nachkommastelle.</p>
<p>UPDATE:<br />
Wer Mathe kann, ist klar im Vorteil. An dieser Stelle ein &#8220;Danke&#8221; an Johannes für diese verblüffend einfach Lösung.</p>
<p>x=ganzzahlanteil(a+0,5)</p>
<p>Bissel drüber nachdenken und es ergibt sich von selbst. Das klappt natürlich nach diesem System([a*10^nachkommastelle+0,5]/10^nachkommastelle) auch für beliebige Nachkommastellen, nicht nur für die Erste.</p>
<p>Die Umsetzung in ein bash script ist dann einfach gewesen:</p>
<p>bash Script:<br />
<code><br />
function round () {<br />
echo $(printf %.$2f $(echo "scale=$2;(((10^$2)*$1)+0.5)/(10^$2)" | bc))<br />
}</code></p>
<p>echo $(round 3.1234 2)<br />
echo $(round 3.1271 2)</p>
<p>Ausgabe<br />
<code><br />
3.12<br />
3.13<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://stempell.com/2009/08/rechnen-in-bash/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux Festplattenfüllstand überwachen</title>
		<link>http://stempell.com/2009/08/linux-festplattenfullstand-uberwachen/</link>
		<comments>http://stempell.com/2009/08/linux-festplattenfullstand-uberwachen/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 15:54:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[hdd]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://stempell.com/?p=433</guid>
		<description><![CDATA[Läuft die Festplatte ständig voll, ohne dass Du es merkst? Dann versuch doch mal dieses Bash Skript: #!/bin/bash ## Author Ingmar Stempell TRESHOLD=80 #Diskusage ALARM="echo \"Platte(\$1) fast voll(\$pvoll)\" &#124; mail -sPlattevoll root"; #what shall we do if [ -z $1 ] then echo "We need one disk to monitor. eg. /dev/hda1" exit 255 fi if [...]]]></description>
			<content:encoded><![CDATA[<p>Läuft die Festplatte ständig voll, ohne dass Du es merkst? Dann versuch doch mal dieses Bash Skript:<br />
<code><br />
#!/bin/bash<br />
## Author Ingmar Stempell<br />
TRESHOLD=80 #Diskusage<br />
ALARM="echo \"Platte(\$1) fast voll(\$pvoll)\" | mail -sPlattevoll root"; #what shall we do<br />
if [ -z $1 ]<br />
        then echo "We need one disk to monitor. eg. /dev/hda1"<br />
        exit 255<br />
fi<br />
if [ -n $2 ]<br />
then<br />
        TRESHOLD=$2<br />
fi<br />
pvoll=$(df $1 | grep $1 | awk '{print $5}')<br />
voll=${pvoll/\%/}<br />
if [ $voll -gt $TRESHOLD ] ; then eval $ALARM ; fi<br />
</code><br />
Es funktioniert gut genug um nach einem Test in Einsatz zu gehen. Aber der Test ist unumgänglich. Kein Skript für Leute, die nicht bereit sind etwas zu testen.</p>
]]></content:encoded>
			<wfw:commentRss>http://stempell.com/2009/08/linux-festplattenfullstand-uberwachen/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

