<?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>weblog von Sebastian Nemak &#187; code</title>
	<atom:link href="http://der-basti.com/weblog/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://der-basti.com/weblog</link>
	<description>Schnee von gestern oder die Zukunft von morgen</description>
	<lastBuildDate>Thu, 12 Jan 2012 18:05:07 +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>Unix Shell Scripting an der HTW Dresden</title>
		<link>http://der-basti.com/weblog/2009/11/unix-shell-scripting-an-der-htw/</link>
		<comments>http://der-basti.com/weblog/2009/11/unix-shell-scripting-an-der-htw/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 09:37:39 +0000</pubDate>
		<dc:creator>Sebastian Nemak</dc:creator>
				<category><![CDATA[Bits und Bytes]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.der-basti.com/?p=56</guid>
		<description><![CDATA[Heute zu Besuch an der HTW Dresden. Es sei folgende Aufgabe gegeben: Stellen Sie eine Shell-Prozedur auf, die ein ausführbares Programm beliebigen Namens zur Abarbeitung bringt! Programmname und die von dem Programm zu verarbeitenden Parameter sind der Prozedur in der Kommandozeile zu übergeben. Die auf stdout erzeugten Ausgaben des Programms sollen wahlweise auf dem Bildschirm [...]]]></description>
			<content:encoded><![CDATA[<p>Heute zu Besuch an der HTW Dresden. Es sei folgende Aufgabe gegeben:</p>
<p>Stellen Sie eine Shell-Prozedur auf, die ein ausführbares Programm beliebigen Namens zur Abarbeitung bringt! Programmname und die von dem Programm zu verarbeitenden Parameter sind der Prozedur in der Kommandozeile zu übergeben. Die auf stdout erzeugten Ausgaben des Programms sollen wahlweise auf dem Bildschirm oder auf dem Drucker oder in eine Datei beliebigen Namens ausgegeben werden. Das Ausgabemedium und ggf. der Dateiname sind in einem Dialog über die Konsole vom Benutzer zu erfragen.</p>
<p><strong>Lösung:</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-ge</span> <span style="color: #000000;">1</span>  <span style="color: #666666; font-style: italic;">#wenn mehr als ein parameter übergeben wird</span>
<span style="color: #000000; font-weight: bold;">then</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Möchten Sie das Programm auf dem [B]ildschirm, auf dem [D]rucker oder
in einem [F]ile ausgeben?&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">read</span> des  <span style="color: #666666; font-style: italic;">#auswahl einlesen</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$des</span> <span style="color: #000000; font-weight: bold;">in</span>
b<span style="color: #000000; font-weight: bold;">|</span>B<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">$*</span><span style="color: #000000; font-weight: bold;">;;</span> <span style="color: #666666; font-style: italic;">#großes oder kleines b gedrückt, ausgabe mit allen parametern</span>
d<span style="color: #000000; font-weight: bold;">|</span>D<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Wird gedruckt...&quot;</span><span style="color: #000000; font-weight: bold;">;;</span>
f<span style="color: #000000; font-weight: bold;">|</span>F<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Bitte geben Sie einen Dateinamen an!&quot;</span>
 <span style="color: #c20cb9; font-weight: bold;">read</span> filename
 <span style="color: #007800;">$*</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$filename</span><span style="color: #000000; font-weight: bold;">;;</span> <span style="color: #666666; font-style: italic;">#schreiben in einer datei</span>
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div>

<p>Und schon ist es gelöst <img src='http://der-basti.com/weblog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://der-basti.com/weblog/2009/11/unix-shell-scripting-an-der-htw/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

