<?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>NerdyRoom™ &#187; bash</title>
	<atom:link href="http://www.nrtm.de/index.php/tag/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nrtm.de</link>
	<description>never read the manual</description>
	<lastBuildDate>Mon, 06 Feb 2012 21:02:39 +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>leading zeros in bash scripts</title>
		<link>http://www.nrtm.de/index.php/2011/07/18/leading-zeros-in-bash-scripts/</link>
		<comments>http://www.nrtm.de/index.php/2011/07/18/leading-zeros-in-bash-scripts/#comments</comments>
		<pubDate>Mon, 18 Jul 2011 15:09:21 +0000</pubDate>
		<dc:creator>Willi</dc:creator>
				<category><![CDATA[bashism]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[padding]]></category>
		<category><![CDATA[zero]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=3511</guid>
		<description><![CDATA[I have a bash script that generates names for binaries, these names include parameters ranging from 2 to 64. I sort these then but due to the nature of alphanumeric sorting, 4 is sorted between 32 and 64 (4 is bigger than 3 but smaller than 6&#8230;). So what i need is leading zeros for [...]]]></description>
			<content:encoded><![CDATA[<p>I have a bash script that generates names for binaries, these names include parameters ranging from 2 to 64. I sort these then but due to the nature of alphanumeric sorting, 4 is sorted between 32 and 64 (4 is bigger than 3 but smaller than 6&#8230;). So what i need is leading zeros for the sorting to work the way i want it to work. The easiest solution i could come up with is padding zeros c-style using the command line version of printf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">PARAMLIST</span>=<span style="color: #ff0000;">&quot;2 4 8 16 24 32 40 48 56 64&quot;</span>
<span style="color: #000000; font-weight: bold;">for</span> PARAM <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$PARAMLIST</span>;
<span style="color: #000000; font-weight: bold;">do</span> 
  <span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;%02d<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #007800;">$PARAM</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p><strong>[update by bert]</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sort</span> –numeric-sort</pre></div></div>

<p> solves the sorting issue as well <img src='http://www.nrtm.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=3511&amp;md5=4b693471e32c320091a0aa4b752082c6" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2011/07/18/leading-zeros-in-bash-scripts/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=3511&amp;md5=4b693471e32c320091a0aa4b752082c6" type="text/html" />
	</item>
		<item>
		<title>Bash: parallel processes</title>
		<link>http://www.nrtm.de/index.php/2011/05/09/bash-parallel-processes/</link>
		<comments>http://www.nrtm.de/index.php/2011/05/09/bash-parallel-processes/#comments</comments>
		<pubDate>Mon, 09 May 2011 10:16:03 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[bashism]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[process]]></category>
		<category><![CDATA[wait]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=3377</guid>
		<description><![CDATA[Sometimes there is a need for spawning multiple sub processes in a shell script and do something after ALL of them have finished. The Bash has nice little features to do this very easily. Here is an example: #!/bin/bash ./process_1 &#38;     # fork first sub process PID_1=$!          # get PID of first sub process ./process_2 [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes there is a need for spawning multiple sub processes in a shell script and do something after ALL of them have finished. The Bash has nice little features to do this very easily.</p>
<p>Here is an example:</p>
<pre>#!/bin/bash
./process_1 &amp;     # fork first sub process
PID_1=$!          # get PID of first sub process
./process_2 &amp;     # fork second sub process
PID_2=$!          # get PID of second sub process

#...do some other work...

wait  ${PID_1}     # stop execution until first process has finished
wait  ${PID_2}     # stop execution until second process has finished

#...all work is done...

exit 0</pre>
<p>With the ampersand (<strong>&amp;</strong>) one can fork sub processes running independent from the parent process.</p>
<p>To avoid busy waiting we want to stop execution of the parent script until the child has finished. So we don&#8217;t use an infinite loop with a check and a sleep or something like that, but a function called <strong>wait</strong> together with the childs&#8217; Process ID.</p>
<p>The PID of a created process can be received by reading <strong>$!</strong> right after the fork. As far as I know this is mostly bash functionality and maybe is not POSIX! (correct me if I&#8217;m wrong)</p>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=3377&amp;md5=f66e38c260aa6bc6795b3da993613835" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2011/05/09/bash-parallel-processes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=3377&amp;md5=f66e38c260aa6bc6795b3da993613835" type="text/html" />
	</item>
		<item>
		<title>Pwned by error message</title>
		<link>http://www.nrtm.de/index.php/2009/08/17/pwned-by-error-message/</link>
		<comments>http://www.nrtm.de/index.php/2009/08/17/pwned-by-error-message/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 11:52:09 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[bashism]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[execution]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=1558</guid>
		<description><![CDATA[In the life of an IT-guy you often shake your head and smile while wondering about the current problem or its solution. So after a while not much can realy surprise you. But last week there was such a rare moment. The problem is an easy one: we could not execute binaries. We have a [...]]]></description>
			<content:encoded><![CDATA[<p>In the life of an IT-guy you often shake your head and smile while wondering about the current problem or its solution. So after a while not much can realy surprise you. But last week there was such a rare moment.</p>
<p>The problem is an easy one: <em>we could not execute binaries</em>. We have a cluster here with an 32 bit head node and 64 bit compute nodes both x86 Debian GNU Linux. The stuff to be shared comes over a NFS. Heterogenouse clusters have some difficulties because you cannot execute binaries from one architecture on another. This will fail with the error message: <strong>&#8220;wrong ELF format&#8221;</strong>.<br />
Our problem first appeared by using the <a href="http://modules.sourceforge.net/" target="_blank">Modules-tool</a>. For testing we executed it directly:</p>
<pre>./modulecmd
-bash: ./modulecmd: no such file or directory
</pre>
<p>But OK, as everybody could see, it was. We checked and changed the rights for users, groups, owndership, parent directories etc. Nothing helped. Next we put an eye on NFS. No miss-configuration or other distinctive feature.<br />
Now we use the bigger weapons and<strong> strace</strong> the command.</p>
<pre>strace ./modulecmd
execve("./modulecmd", ["./modulecmd"], [/* 25 vars */]) = -1 ENOENT (No such file or directory)
dup(2)                                  = 3
fcntl(3, F_GETFL)                       = 0x8002 (flags O_RDWR|O_LARGEFILE)
fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 0), ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7ff4b4700000
lseek(3, 0, SEEK_CUR)                   = -1 ESPIPE (Illegal seek)
write(3, "strace: exec: No such file or dir"..., 40strace: exec: No such file or directory
) = 40
close(3)                                = 0
munmap(0x7ff4b4700000, 4096)            = 0
exit_group(1)                           = ?
</pre>
<p>Also nothing surprising in here.<br />
The further isolate the root of the behaviour, we code a short &#8220;hello world&#8221; in C and do compiling and execution and it worked. So here we got the main point which confused us. Self created binaries and all system tools worked properly, just the shared ones or let&#8217;s say &#8220;not system contained&#8221; executables failed.<br />
OK, maybe it&#8217;s situated in a deeper level. We installed <strong>dash</strong> and try to execute it in there. No changes. Slowly but steady we ran out of ideas.<br />
From the <strong>strace</strong> run we could see that <strong>execve</strong> backfired. This command overwrites the current forked process with the binary given by a path as an argument and executes it. So maybe the reason belongs to the execution context. We tried</p>
<p><img class="aligncenter size-full wp-image-1584" src="http://www.nrtm.de/wp-content/uploads/2009/08/bashism.png" alt="bashism" width="600" height="53" /></p>
<p>instead. So WTF? After ignoring some charset ideas in mind, we arrived where we started. An obligatory <strong>file</strong> on a system executable and our binary shared over NFS told us the wrong ELF type. The installation of<strong> ia32-libs</strong> fixed the problem finally, but why there was a <strong>&#8220;no such file of directory&#8221;</strong> instead of a <strong>&#8220;wrong ELF type&#8221;</strong> we still do not know.</p>
<p>You are welcome to give us solution or hints.</p>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=1558&amp;md5=a8015502a0ae418ca459c67098e5612d" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/08/17/pwned-by-error-message/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=1558&amp;md5=a8015502a0ae418ca459c67098e5612d" type="text/html" />
	</item>
		<item>
		<title>compiling from sources</title>
		<link>http://www.nrtm.de/index.php/2009/06/26/compiling-from-sources/</link>
		<comments>http://www.nrtm.de/index.php/2009/06/26/compiling-from-sources/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 03:49:07 +0000</pubDate>
		<dc:creator>Willi</dc:creator>
				<category><![CDATA[bashism]]></category>
		<category><![CDATA[c/c++]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cmake]]></category>
		<category><![CDATA[configure]]></category>
		<category><![CDATA[make]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=1317</guid>
		<description><![CDATA[I&#8217;ve been hacking around the last 4 days trying to build up a stack of 5 hpc tools all depending on each other each with a special set of features enabled &#8211; pure horror. After switching between cutting edge versions and wildly interchanging compiler-suites all with different non-positive outcome I think I&#8217;m finally done. Man [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been hacking around the last 4 days trying to build up a stack of 5 hpc tools all depending on each other each with a special set of features enabled &#8211; pure horror. After switching between cutting edge versions and wildly interchanging compiler-suites all with different non-positive outcome I think I&#8217;m finally done. Man vs machine 1:0 &#8211; gotcha <img src='http://www.nrtm.de/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Here 2 of the more interesting snippets I had to create to get things up an running:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># add missing string.h</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;#include  string.h&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span>swap.c
<span style="color: #c20cb9; font-weight: bold;">cat</span> .<span style="color: #000000; font-weight: bold;">/</span>SRC<span style="color: #000000; font-weight: bold;">/</span>SRC<span style="color: #000000; font-weight: bold;">/</span>mpo_LogCube3.cc <span style="color: #000000; font-weight: bold;">&gt;&gt;</span>swap.c
<span style="color: #c20cb9; font-weight: bold;">mv</span> swap.c .<span style="color: #000000; font-weight: bold;">/</span>SRC<span style="color: #000000; font-weight: bold;">/</span>SRC<span style="color: #000000; font-weight: bold;">/</span>mpo_LogCube3.cc</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># fix wrong marmotcc (missing scalasca-lib)</span>
<span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/-lcube3/-lcube3 -lsc.z/g'</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">which</span> marmotcc<span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">&gt;</span>marmotcc
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x marmotcc
<span style="color: #c20cb9; font-weight: bold;">mv</span> .<span style="color: #000000; font-weight: bold;">/</span>marmotcc <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">which</span> marmotcc<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>I had to use dos2unix as one script had windows coding and so my shell was complaining about not knowing /bin/bash^M and so on. I also wrote a script creating ./configure lines with all possible combinations of a set of flags to test which combination actually works . . .<br />
Sometimes I&#8217;d really like those days back were a &#8220;cc hello.c -o HelloWorld&#8221; was all that was needed.</p>
<p>BNW</p>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=1317&amp;md5=0295cc77913c152543fec29b943b44ec" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/06/26/compiling-from-sources/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=1317&amp;md5=0295cc77913c152543fec29b943b44ec" type="text/html" />
	</item>
		<item>
		<title>It&#8217;s about time</title>
		<link>http://www.nrtm.de/index.php/2009/06/17/its-about-time/</link>
		<comments>http://www.nrtm.de/index.php/2009/06/17/its-about-time/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 13:12:34 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[bashism]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[time]]></category>
		<category><![CDATA[type]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=1279</guid>
		<description><![CDATA[The tiny tool time everybody should know, measures execution time of a given command. For example: time echo &#34;test&#34; prints time information to the console. But what if you want to collect these statistics in a file? Linux man page say &#8220;-o FILE&#8221; is the way to do so. This will look like time  -o [...]]]></description>
			<content:encoded><![CDATA[<p>The tiny tool <em><strong>time</strong></em> everybody should know, measures execution time of a given command. For example:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">time</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;test&quot;</span></pre></div></div>

<p>prints time information to the console. But what if you want to collect these statistics in a file? Linux man page say <em>&#8220;-o FILE&#8221;</em> is the way to do so. This will look like</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">time</span>  <span style="color: #660033;">-o</span> file.log <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;test&quot;</span></pre></div></div>

<p>This <strong>FAILS</strong> not only on my machine with the error message &#8220;bash -o: unknown command&#8221; or equal. The key is to give the full path:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight: bold;">time</span> <span style="color: #660033;">-o</span> file.log <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;test&quot;</span></pre></div></div>

<p>The problem is, that &#8220;time&#8221; is used for different things. This leads to another cute tool called <em><strong>type</strong></em>. type gives information about the kind of a command.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">type</span> <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">time</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">time</span> is a shell keyword
<span style="color: #000000; font-weight: bold;">time</span> is <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000; font-weight: bold;">time</span></pre></div></div>

<p>As you can see &#8220;time&#8221; not only means the command. If somebody knows more about the &#8220;Why the hell is this so?&#8221;, feel free to post <img src='http://www.nrtm.de/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=1279&amp;md5=d9e9397cee520b3909932e8f2da2ea74" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/06/17/its-about-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=1279&amp;md5=d9e9397cee520b3909932e8f2da2ea74" type="text/html" />
	</item>
		<item>
		<title>Disable bell on every terminal types</title>
		<link>http://www.nrtm.de/index.php/2009/04/01/disable-bell-on-every-terminal-types/</link>
		<comments>http://www.nrtm.de/index.php/2009/04/01/disable-bell-on-every-terminal-types/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 12:28:51 +0000</pubDate>
		<dc:creator>stefan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=503</guid>
		<description><![CDATA[Just put the following line into /etc/profile or similar and your Terminal will &#8216;never&#8217; annoy you again. setterm -blength 0]]></description>
			<content:encoded><![CDATA[<p>Just put the following line into <strong>/etc/profile</strong> or similar and your Terminal will &#8216;never&#8217; annoy you again.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">setterm</span> <span style="color: #660033;">-blength</span> <span style="color: #000000;">0</span></pre></div></div>

 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=503&amp;md5=d466a5804d0f3bd93883083e99e605f6" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/04/01/disable-bell-on-every-terminal-types/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=503&amp;md5=d466a5804d0f3bd93883083e99e605f6" type="text/html" />
	</item>
		<item>
		<title>ZIH nameserver für NRtm</title>
		<link>http://www.nrtm.de/index.php/2009/02/26/zih-nameserver-fur-nrtm/</link>
		<comments>http://www.nrtm.de/index.php/2009/02/26/zih-nameserver-fur-nrtm/#comments</comments>
		<pubDate>Thu, 26 Feb 2009 09:03:07 +0000</pubDate>
		<dc:creator>robert</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[nameserver]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[ZIH]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=206</guid>
		<description><![CDATA[da bei uns im NRTM die ZIH und HRSK names nicht ganz resolved werden &#8211; also gar nicht &#8211; hier ein Script, dass nach dem Verbinden zum Netzwerk gestartet werden kann: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 #!/bin/sh # already inserted? [...]]]></description>
			<content:encoded><![CDATA[<p>da bei uns im NRTM die ZIH und HRSK names nicht ganz resolved werden &#8211; also gar nicht &#8211; hier ein Script, dass nach dem Verbinden zum Netzwerk gestartet werden kann:</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
15
16
17
18
19
20
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># already inserted?</span>
<span style="color: #007800;">ALREADY_IN_FILE</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> \<span style="color: #666666; font-style: italic;">#\  \ auto\ inserted | wc -l`</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$ALREADY_IN_FILE</span> <span style="color: #660033;">-ge</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;already inserted&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #666666; font-style: italic;"># am i root?</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">id</span> -u<span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;This must be run as root, try&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;sudo <span style="color: #007800;">${0}</span>&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #666666; font-style: italic;"># insert</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;#  auto inserted&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;search xxx.de xxy.de&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;nameserver ip1&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;nameserver ip2&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>resolv.conf</pre></td></tr></table></div>

<p>Nach einem neuen Verbinden ins DHCP Netzwerk muss es leider wieder eingetragen werden. IP adressen und so gibts auf anfrage.</p>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=206&amp;md5=42d6ab15ce0acb21e847193f4401a29c" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/02/26/zih-nameserver-fur-nrtm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=206&amp;md5=42d6ab15ce0acb21e847193f4401a29c" type="text/html" />
	</item>
		<item>
		<title>nanoblogger</title>
		<link>http://www.nrtm.de/index.php/2009/02/23/nanoblogger/</link>
		<comments>http://www.nrtm.de/index.php/2009/02/23/nanoblogger/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 19:49:52 +0000</pubDate>
		<dc:creator>robin</dc:creator>
				<category><![CDATA[software]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[nanoblogger]]></category>

		<guid isPermaLink="false">http://www.nrtm.de/?p=135</guid>
		<description><![CDATA[nanoblogger powered by vim, bash, cat, grep, sed, and nb 3.4 RC2 sehr genial. Bloging Software die per bash scripten statisches html erzeugt und per command line gesteuert wird. http://wwwpub.zih.tu-dresden.de/~rgeyer/ :: Beispiel http://nanoblogger.sourceforge.net/ :: sf.net link]]></description>
			<content:encoded><![CDATA[<p>nanoblogger powered by vim, bash, cat, grep, sed, and nb 3.4 RC2 sehr genial. Bloging Software die per bash scripten statisches html erzeugt und per command line gesteuert wird.</p>
<ul>
<li><a href="http://wwwpub.zih.tu-dresden.de/~rgeyer/" target="_blank">http://wwwpub.zih.tu-dresden.de/~rgeyer/</a> :: Beispiel</li>
<li><a href="http://nanoblogger.sourceforge.net/" target="_blank">http://nanoblogger.sourceforge.net/</a> :: sf.net link</li>
</ul>
 <p><a href="http://www.nrtm.de/?flattrss_redirect&amp;id=135&amp;md5=7e61163992c3f6ed1a27e1e60114d51c" title="Flattr" target="_blank"><img src="https://www.nrtm.de/wp-content/plugins/flattrss/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.nrtm.de/index.php/2009/02/23/nanoblogger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.nrtm.de/?flattrss_redirect&amp;id=135&amp;md5=7e61163992c3f6ed1a27e1e60114d51c" type="text/html" />
	</item>
	</channel>
</rss>

