<?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>KillerBlog.net &#187; Programming</title>
	<atom:link href="http://www.killerblog.net/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.killerblog.net</link>
	<description>Flippin Sweet!</description>
	<lastBuildDate>Sun, 25 Sep 2011 18:10:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unix Shell Scripting &#8211; Remake the rm command with a trashbin</title>
		<link>http://www.killerblog.net/unix-shell-scripting-remake-the-rm-command-with-a-trashbin/</link>
		<comments>http://www.killerblog.net/unix-shell-scripting-remake-the-rm-command-with-a-trashbin/#comments</comments>
		<pubDate>Mon, 01 Dec 2008 19:20:51 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[School Work]]></category>
		<category><![CDATA[rm script]]></category>
		<category><![CDATA[shell scripting]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[unix programming]]></category>

		<guid isPermaLink="false">http://www.killerblog.net/?p=79</guid>
		<description><![CDATA[Below is the code to remake the rm command. I remade it so I could send everything i delete to a trashbin. It sends it to your home/.Trashbin. If the directory isnt there, it makes it for you. After that it tests to see if there are any arguments after the command, and if there [...]]]></description>
			<content:encoded><![CDATA[<p>Below is the code to remake the rm command. I remade it so I could send everything i delete to a trashbin. It sends it to your home/.Trashbin. If the directory isnt there, it makes it for you. After that it tests to see if there are any arguments after the command, and if there are 0 it sends back a message. If there are arguments it continues. If the second argument is the -r flag then it send everything after the flag to the trashbin, no matter what. If there isnt the -r present then it only sends files to the trashbin, and if it finds out you tried to delete a directory, it sends back an error. This was made in a bourne-again shell.</p>
<p>Thanks!</p>
<p>Checkout the code below.<span id="more-79"></span></p>
<pre>
#!/bin/sh
if ! test -d $HOME/.Trashcan
   then
   mkdir $HOME/.Trashcan
fi
if test $# -eq 0
  then
    echo $0:missing operand - moron
exit 1
fi
if test $1 = "-r"
  then
  shift
    for stuff in $*
    do
  if test -d $stuff
  then
    mv $stuff $HOME/.Trashcan
      elif test -f $stuff
    then
        mv $stuff $HOME/.Trashcan
fi
done
  else
    for stuff2 in $*
    do
if test -f $stuff2
  then
  mv $stuff2 $HOME/.Trashcan
fi
  if test -d $stuff2
  then
    echo "myrm: cannot remove $stuff2: Is a directory. moron"
fi
done
fi
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.killerblog.net/unix-shell-scripting-remake-the-rm-command-with-a-trashbin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Unix Shell Scripting &#8211; Guessing Game</title>
		<link>http://www.killerblog.net/unix-shell-scripting-guessing-game/</link>
		<comments>http://www.killerblog.net/unix-shell-scripting-guessing-game/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 19:12:54 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[School Work]]></category>
		<category><![CDATA[guessing game]]></category>
		<category><![CDATA[shell scripting]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.killerblog.net/?p=76</guid>
		<description><![CDATA[Hey all, this is a guessing game I have written for my operating systems class. It was written for a bash (bourne again shell) unix operating system. It uses a simple while loop with if loops nested in it to see if the guessed number is higher or lower than the random number. #!/bin/sh #gueessing [...]]]></description>
			<content:encoded><![CDATA[<p>Hey all, this is a guessing game I have written for my operating systems class. It was written for a bash (bourne again shell) unix operating system.</p>
<p>It uses a simple while loop with if loops nested in it to see if the guessed number is higher or lower than the random number.</p>
<p><code>#!/bin/sh<br />
#gueessing game<br />
biggest=50<br />
guess=0<br />
guesses=0<br />
number=$(( $$ % $biggest ))<br />
while [ $guess -ne $number ] ; do<br />
   echo -n "Guess? " ; read guess<br />
   if [ "$guess" -lt $number ] ; then<br />
      echo "... bigger!"<br />
   elif [ "$guess" -gt $number ] ; then<br />
      echo "... smaller!"<br />
fi<br />
guesses=$(( $guesses + 1 ))<br />
done<br />
echo "Right!! Guessed $number in $guesses guesses."<br />
exit 0<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.killerblog.net/unix-shell-scripting-guessing-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

