<?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>PhYnformatik</title>
	<atom:link href="http://phynformatik.de/feed/" rel="self" type="application/rss+xml" />
	<link>http://phynformatik.de</link>
	<description>Linux, Games and More</description>
	<lastBuildDate>Sat, 28 Jan 2012 08:51:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>(Deutsch) Zusammenfassung Grundlagen Datenerhebung</title>
		<link>http://phynformatik.de/2012/01/25/deutsch-zusammenfassung-grundlagen-datenerhebung/</link>
		<comments>http://phynformatik.de/2012/01/25/deutsch-zusammenfassung-grundlagen-datenerhebung/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 12:26:32 +0000</pubDate>
		<dc:creator>Phylu</dc:creator>
				<category><![CDATA[University]]></category>
		<category><![CDATA[Psychology]]></category>
		<category><![CDATA[TUM]]></category>

		<guid isPermaLink="false">http://phynformatik.de/?p=1101</guid>
		<description><![CDATA[Sorry, this entry is only available in Deutsch.]]></description>
			<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://phynformatik.de/de/feed/">Deutsch</a>.</p>
<p class="wp-flattr-button"></p> <p><a href="http://phynformatik.de/wordpress/?flattrss_redirect&amp;id=1101&amp;md5=01c43280b0be67434feb34dddfa628e7" title="Flattr" target="_blank"><img src="http://phynformatik.de/wordpress/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://phynformatik.de/2012/01/25/deutsch-zusammenfassung-grundlagen-datenerhebung/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(Deutsch) Grooveshark in Deutschland nicht mehr zu erreichen</title>
		<link>http://phynformatik.de/2012/01/18/deutsch-grooveshark-in-deutschland-nicht-mehr-zu-erreichen/</link>
		<comments>http://phynformatik.de/2012/01/18/deutsch-grooveshark-in-deutschland-nicht-mehr-zu-erreichen/#comments</comments>
		<pubDate>Wed, 18 Jan 2012 12:22:26 +0000</pubDate>
		<dc:creator>Phylu</dc:creator>
				<category><![CDATA[Internet Applications]]></category>
		<category><![CDATA[PhYnformatik]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[Planeten Blogger]]></category>

		<guid isPermaLink="false">http://phynformatik.de/?p=1098</guid>
		<description><![CDATA[Sorry, this entry is only available in Deutsch.]]></description>
			<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://phynformatik.de/de/feed/">Deutsch</a>.</p>
<p class="wp-flattr-button"></p> <p><a href="http://phynformatik.de/wordpress/?flattrss_redirect&amp;id=1098&amp;md5=f1a8d8f83934f77828a81accfbccebe1" title="Flattr" target="_blank"><img src="http://phynformatik.de/wordpress/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://phynformatik.de/2012/01/18/deutsch-grooveshark-in-deutschland-nicht-mehr-zu-erreichen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash Example Script #2</title>
		<link>http://phynformatik.de/2012/01/05/bash-example-script-2/</link>
		<comments>http://phynformatik.de/2012/01/05/bash-example-script-2/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 23:32:09 +0000</pubDate>
		<dc:creator>Phylu</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Desktop Software]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planeten Blogger]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[TUM]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://phynformatik.de/?p=1089</guid>
		<description><![CDATA[I have added the following function to my bash example script:
# Run external command and only procced, when exit code is 0
function try {
	$@
	returnValue=$?
	echo "$returnValue"
	if 
	then
		log $ERROR "$@ exited with return value \
		$returnValue Script will stop here."
		echo "$@ exited with ...]]></description>
			<content:encoded><![CDATA[<p>I have added the following function to my bash example script:</p>
<pre># Run external command and only procced, when exit code is 0
function try {
	$@
	returnValue=$?
	echo "$returnValue"
	if [ $returnValue -ne 0 ]
	then
		log $ERROR "$@ exited with return value \
		$returnValue Script will stop here."
		echo "$@ exited with return value $returnValue. \
		Script will stop here."
		exit $EXIT_FAILURE
	fi
}</pre>
<p>The function takes a program as an argument and runs in. If the program returns with a status other then 0, so it fails, then the script will print an error message, log it and and exits. I needed this behaviour in some recent scripts and hope it to be usefull for everybody else.</p>
<p class="wp-flattr-button"></p> <p><a href="http://phynformatik.de/wordpress/?flattrss_redirect&amp;id=1089&amp;md5=5f5946a6fb1e589a5a9799aa189a804c" title="Flattr" target="_blank"><img src="http://phynformatik.de/wordpress/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://phynformatik.de/2012/01/05/bash-example-script-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bash Example Script</title>
		<link>http://phynformatik.de/2011/12/29/bash-example-script/</link>
		<comments>http://phynformatik.de/2011/12/29/bash-example-script/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 16:54:12 +0000</pubDate>
		<dc:creator>Phylu</dc:creator>
				<category><![CDATA[Desktop Software]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[PhYnformatik]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[Free]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planeten Blogger]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[TUM]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://phynformatik.de/?p=1072</guid>
		<description><![CDATA[These days I use bash more and more often for simple tasks on my Linux system, as well as for a University course I am taking.

Have a look at the script:
#!/bin/bash
# Skript: bash_example.sh
# Credit to: http://www.pro-linux.de/artikel/2/111/
#1,ein-shellskript-template.html
#
# I have added some usefull functions that I ...]]></description>
			<content:encoded><![CDATA[<p>These days I use bash more and more often for simple tasks on my Linux system, as well as for a University course I am taking.</p>
<p>Have a look at the script:</p>
<pre>#!/bin/bash
# Skript: bash_example.sh
# Credit to: http://www.pro-linux.de/artikel/2/111/
#1,ein-shellskript-template.html
#
# I have added some usefull functions that I am using in many
# of my scripts
# Find this script here: http://phynformatik.de
# Janosch Maier
#
# This work is licensed under the
# Creative Commons Attribution-Share Alike License
#
# You are free
# to Share — to copy, distribute and transmit the work
# to Remix — to adapt the work
# to make commercial use of the work
#
# Under the following conditions:
# Attribution — You must attribute the work in the manner
# specified by the author or licensor (but not in any way
# that suggests that they endorse you or your use of the work).
# Share Alike — If you alter, transform, or build upon this
# work, you may distribute the resulting work only under the
# same or similar license to this one.
version="0.1"
lastChange="14.12.2011"

#### CONFIG - DO NOT MAKE CHANGES HERE ####
# PATH has to be a trusted value
# Try to make this script save in unsave environments
# "." cannot be in PATH
PATH=/bin:/sbin:/usr/bin:/usr/sbin/:/usr/local/bin:/usr/local/sbin
export PATH

# Environment variable IFS should always be
# "" or undefined
# Same as with PATH
if [ -z "$IFS" ]
then
        IFS="
"
        export IFS
fi

#### YOU CAN START MAKING CHANGES FROM HERE ON ####
# Define global variables for later use
# Name of the script is its filename (without possible suffix .sh)
SCRIPTNAME=$(basename $0 .sh)
# Define Exit values
EXIT_SUCCESS=0
EXIT_FAILURE=1
EXIT_ERROR=2
EXIT_BUG=10
# Logfile will be put under current working directory
LOGFILE=`readlink -f "$SCRIPTNAME.log"`

# Error values
ERROR="ERROR"
WARNING="WARNING"
INFO="INFO"
NOTICE="NOTICE"

# Default values for options
VERBOSE=false
DEBUGLEVEL=1

#### FUNCTIONS FOR LATER USE ####
# Print usage message
function usage {
	echo "Usage: $SCRIPTNAME [-h] [-v] [-d debuglevel] file ...

  -h		show this help
  -v		be verbose
  -d		set debug level (1-9)
	[[ $# -eq 1 ]] &amp;&amp; exit $1 || exit $EXIT_FAILURE
}

# Log stuff to the defined logfile
# Call "log $ERROR|$WARNING|$INFO|$NOTICE message"
function log {
	case $1 in
		$ERROR)
			if [ $DEBUGLEVEL -ge 1 ]
			then
				shift
				echo "$(date '+%F %T') $ERROR: $@" \
                                &gt;&gt; $LOGFILE
			fi
			;;
		$WARNING)
			if [ $DEBUGLEVEL -ge 3 ]
			then
				shift
				echo "$(date '+%F %T') $WARNING: $@" \
                                &gt;&gt; $LOGFILE
			fi
			;;
		$INFO)
			if [ $DEBUGLEVEL -ge 5 ]
			then
				shift
				echo "$(date '+%F %T') $INFO: $@" \
                                &gt;&gt; $LOGFILE
			fi
			;;
		$NOTICE)
			if [ $DEBUGLEVEL -ge 7 ]
			then
				shift
				echo "$(date '+%F %T') $NOTICE: $@" \
                                &gt;&gt; $LOGFILE
			fi
			;;
		*)
			echo "$(date '+%F %T') BUG: $@" \
                        &gt;&gt; $LOGFILE
			;;
	esac
}

# Echo a string if verbose mode is set
# Log as an Info message in any case
function echo_verbose {
	if [ "$VERBOSE" == "true" ]
	then
		echo $@
	fi
	log $INFO "$@"
}

# Echo a string and put it to Error log
function echo_error {
        log $ERROR "$@"
        echo "$ERROR: $@" &gt;&amp;2
}

#### GETTING ALL OPTIONS #####
# Option -h gives some help
# Option -v makes the script verbose
# Option -o has one option argument therefore o:
while getopts ':o:d:vh' OPTION ; do
	case $OPTION in
		v) VERBOSE=true
		;;
 		h) usage $EXIT_SUCCESS
 		;;
		d) DEBUGLEVEL="$OPTARG"
		;;
 		\?) echo "Unknown Option \"-$OPTARG\"." &gt;&amp;2
 		usage $EXIT_ERROR
 		;;
	 <img src='http://phynformatik.de/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  echo "Option \"-$OPTARG\" needs an argument." &gt;&amp;2
		usage $EXIT_ERROR
		;;
		*) echo "There should never happen..." &gt;&amp;2
		usage $EXIT_BUG
		;;
	esac
done

#### DO CHECKS ON THE ARGUMENTS ####
# $OPTIND is number of options gotten by getopts + 1
# Therefore shift arguments gotte by OPTIND - 1
shift $(( OPTIND - 1 ))

# Check if the number of arguments gotten is correct
if (( $# &lt; 1 || $# &gt; 2)) ; then
	echo "One or two arguments needed." &gt;&amp;2
	log ERR "1 or 2 arguments needed. $# arguments gotten"
	usage $EXIT_ERROR
fi

#### DO SOME STUFF HERE ####
# Do something for all other arguments
for ARG ; do
	echo_verbose "Doing stuff for an argument"
	echo $ARG
done

# The script succeded doing its work
exit $EXIT_SUCCESS</pre>
<p>&nbsp;</p>
<p>I have tried to comment the script as good as possible. Explanation for some parts of the script can be found at the <a title="Ein Shellscript-Template" href="http://www.pro-linux.de/artikel/2/111/2,ein-shellskript-template.html">page</a> the base for this script originates from. Feel free to ask questions, if something is not understandable.</p>
<p>&nbsp;</p>
<p>Download the script: <a href="http://phynformatik.de/wordpress/wp-content/uploads/2011/12/bash_example.sh_.txt">bash_example.sh</a>.</p>
<p class="wp-flattr-button"></p> <p><a href="http://phynformatik.de/wordpress/?flattrss_redirect&amp;id=1072&amp;md5=36df4826ad5ac56fc099251201351fc6" title="Flattr" target="_blank"><img src="http://phynformatik.de/wordpress/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://phynformatik.de/2011/12/29/bash-example-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Single Language</title>
		<link>http://phynformatik.de/2011/12/29/single-language/</link>
		<comments>http://phynformatik.de/2011/12/29/single-language/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 16:31:01 +0000</pubDate>
		<dc:creator>Phylu</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PhYnformatik]]></category>
		<category><![CDATA[Blog News]]></category>

		<guid isPermaLink="false">http://phynformatik.de/?p=1069</guid>
		<description><![CDATA[Unfortunately I do not have the time, I used to have. I will not be able to write every article twice in German and in English.

I hope, that you can forgive me if I continue this Blog with most articles in English only. Perhaps ...]]></description>
			<content:encoded><![CDATA[<p>Unfortunately I do not have the time, I used to have. I will not be able to write every article twice in German and in English.</p>
<p>I hope, that you can forgive me if I continue this Blog with most articles in English only. Perhaps I can take this as motivation to write more frequently as well.</p>
<p class="wp-flattr-button"></p> <p><a href="http://phynformatik.de/wordpress/?flattrss_redirect&amp;id=1069&amp;md5=b6770793354613112bbd1ac780dbc970" title="Flattr" target="_blank"><img src="http://phynformatik.de/wordpress/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://phynformatik.de/2011/12/29/single-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

