<?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>Alexander Jäger&#187; if</title>
	<atom:link href="http://www.alexanderjaeger.de/tag/if/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alexanderjaeger.de</link>
	<description>Alex Jäger</description>
	<lastBuildDate>Mon, 30 Jan 2012 18:36:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Bash Script Array und if Problem</title>
		<link>http://www.alexanderjaeger.de/bash-script-array-und-if-problem/</link>
		<comments>http://www.alexanderjaeger.de/bash-script-array-und-if-problem/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 20:43:59 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[array ausgabe]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bash script]]></category>
		<category><![CDATA[bin/sh]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[fi]]></category>
		<category><![CDATA[hallo welt]]></category>
		<category><![CDATA[hello world]]></category>
		<category><![CDATA[if]]></category>
		<category><![CDATA[Problem]]></category>
		<category><![CDATA[sh]]></category>

		<guid isPermaLink="false">http://www.alexanderjaeger.de/?p=150</guid>
		<description><![CDATA[Hier ein paar kleine Kniffe in Bezug auf Bash Scripte: Um einen Array mit Werten anzulegen und diese Werte zu durchlaufen: #!/bin/bash TESTARRAY=(hallo welt dies ist ein Array Test) for i in ${TESTARRAY[@]} do echo $i done Diese Ausgabe erzeugt eine zeilenweise Ausgabe der einzelnen Strings im Array. Als zweites noch ein kleines Kniff bei [...]]]></description>
			<content:encoded><![CDATA[<p>Hier ein paar kleine Kniffe in Bezug auf Bash Scripte:</p>
<p>Um einen Array mit Werten anzulegen und diese Werte zu durchlaufen:</p>
<blockquote>
<pre class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; text-align: left;" dir="ltr">#!/bin/bash

TESTARRAY=(hallo welt dies ist ein Array Test)
for i in ${TESTARRAY[@]}
do
  echo $i
done</pre>
</blockquote>
<p>Diese Ausgabe erzeugt eine zeilenweise Ausgabe der einzelnen Strings im Array.</p>
<p>Als zweites noch ein kleines Kniff bei if-Abfragen in Bash Scripten.<br />
Ein häufig auftretendes Problem, ist ein nicht betreten des Code Teils nach einer if Abfrage:</p>
<blockquote>
<pre class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto;  text-align: left;" dir="ltr">SELECT=`date '+%w'`
if [["$SELECT" -eq 3]];
then
echo "hello World"
fi</pre>
</blockquote>
<p>Diese if Anweisung wird nie erfüllt werden, das Problem sind die fehlenden Leerzeichen in der Bedingung.<br />
Mit</p>
<blockquote>
<pre class="alt2" style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto;  text-align: left;" dir="ltr">SELECT=`date '+%w'`
if [[<strong> "$SELECT" -eq 3 </strong>]];
then
echo "hello World"
fi</pre>
</blockquote>
<p>funktioniert es wie gewünscht.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alexanderjaeger.de/bash-script-array-und-if-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

