<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<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/"
	>

<channel>
	<title>Linux</title>
	<link>http://linux.blowshard.net</link>
	<description>/dev/urandom</description>
	<pubDate>Wed, 19 Mar 2008 15:53:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Bash scripting : The importance of a sanity check</title>
		<link>http://linux.blowshard.net/2008/03/19/bash-scripting-the-importance-of-a-sanity-check/</link>
		<comments>http://linux.blowshard.net/2008/03/19/bash-scripting-the-importance-of-a-sanity-check/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 15:45:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://linux.blowshard.net/2008/03/19/bash-scripting-the-importance-of-a-sanity-check/</guid>
		<description><![CDATA[echo "Execute $somecode ?"
read bogusvar
$somecode
-----
The above might be the most important part of any bash script.  It does two things :
1. Shows you the actual command being executed
 2.  Gives you the chance to cancel the program
I recently learned the importance of this when &#8220;rm -rf $variable&#8221; became &#8220;rm -rf /&#8221; when executed. [...]]]></description>
			<content:encoded><![CDATA[<pre>echo "Execute $somecode ?"
read bogusvar
$somecode</pre>
<pre>-----</pre>
<p>The above might be the most important part of any bash script.  It does two things :</p>
<p><strong>1.</strong> Shows you the actual command being executed<br />
<strong> 2.</strong>  Gives you the chance to cancel the program</p>
<p>I recently learned the importance of this when &#8220;rm -rf $variable&#8221; became &#8220;rm -rf /&#8221; when executed.  Before I realized what was going on /etc/ and a dozen /home/username/ directories were gone.</p>
<p>Avoid making the same mistake by incorporating some form of a sanity check into all of your bash scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://linux.blowshard.net/2008/03/19/bash-scripting-the-importance-of-a-sanity-check/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bash Script : Batch convert mp3</title>
		<link>http://linux.blowshard.net/2007/03/10/bash-script-batch-convert-mp3/</link>
		<comments>http://linux.blowshard.net/2007/03/10/bash-script-batch-convert-mp3/#comments</comments>
		<pubDate>Sat, 10 Mar 2007 17:22:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[mp3]]></category>

		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://linux.blowshard.net/2007/03/10/bash-script-batch-convert-mp3/</guid>
		<description><![CDATA[So today I needed a bash script that will use lame to batch covert mp3 files to a lower bitrate so I can squeeze more onto my mp3 player.
After looking around on the net and taking bits of other peoples code (thanks NoStop and keefaz) I came up with this :
Use at your own risk [...]]]></description>
			<content:encoded><![CDATA[<p>So today I needed a bash script that will use lame to batch covert mp3 files to a lower bitrate so I can squeeze more onto my mp3 player.</p>
<p>After looking around on the net and taking bits of other peoples code (<strong>thanks <a href="http://www.linuxforums.org/forum/linux-programming-scripting/25206-noob-question-about-script-batch-file-processing.html">NoStop</a> and <a href="http://www.linuxquestions.org/questions/showthread.php?t=309567">keefaz</a></strong>) I came up with this :</p>
<p><strong>Use at your own risk !</strong></p>
<p>Watch out for lame to generate errors.  I had some damaged mp3 files and when lame tried to convert them it generated an error then stop processing.</p>
<pre>
#!/bin/sh    

#Be sure to edit as needed !
#Step 1 - Remove the spaces from the names
#example : Track 1.mp3 will be renamed to Track_1.mp3
#This is done because step 2 can't hand spaces in file names    

for f in *; do
file=$(echo $f | tr ' ' _)
[ ! -f $file ] &amp;&amp; mv "$f" $file
done    

#Step 2
#Convert mp3 to a lower quality
#All mp3s are converted to 112 bit using "-b 112"
#All mp3s given names with _112 at the end
#example : Track_1.mp3 will be converted to Track_1_112.mp3
ls -1 *.mp3 | sed "s/(.*).mp3/1.mp3 1_112.mp3/" | xargs -n 2 lame -b 112</pre>
]]></content:encoded>
			<wfw:commentRss>http://linux.blowshard.net/2007/03/10/bash-script-batch-convert-mp3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bash Script : GNOME vs KDE</title>
		<link>http://linux.blowshard.net/2007/03/05/bash-script-gnome-vs-kde/</link>
		<comments>http://linux.blowshard.net/2007/03/05/bash-script-gnome-vs-kde/#comments</comments>
		<pubDate>Tue, 06 Mar 2007 01:52:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://linux.blowshard.net/?p=7</guid>
		<description><![CDATA[Answer the age old question.
Download script here.

#!/bin/sh
# Which is better, GNOME or KDE ?
#
# Version : .014 beta
# Last changes : 3/7/2007
# http://linux.blowshard.net
#
# Not for use in a production environment

ver=".013 beta"
wmCheck="GNOME"    #GNOME goes firstâ€¦
echo
echo "KDE vs GNOME $ver"
echo
while [ "$solved" != "2" ]; do

	if [ "$wmCheck" = "GNOME" ]; then
		other="KDE"
		else
		other="GNOME"
	fi
echo "Does $wmCheck [...]]]></description>
			<content:encoded><![CDATA[<p>Answer the age old question.<br />
Download script <a href="http://www.blowshard.net/offsite/kvg.sh" title="kvg.sh bash script">here</a>.</p>
<pre>
#!/bin/sh
# Which is better, GNOME or KDE ?
#
# Version : .014 beta
# Last changes : 3/7/2007
# http://linux.blowshard.net
#
# Not for use in a production environment

ver=".013 beta"
wmCheck="GNOME"    #GNOME goes firstâ€¦
echo
echo "KDE vs GNOME $ver"
echo
while [ "$solved" != "2" ]; do

	if [ "$wmCheck" = "GNOME" ]; then
		other="KDE"
		else
		other="GNOME"
	fi
echo "Does $wmCheck have the features you want ? "
echo -n "(Y)es (N)o (U)nsure : "
read bobloblaw	#Any Arrested Development fans ?
echo

case $bobloblaw in

	[Yy])
	winner=$wmCheck
	loser=$other
	wmCheck=$other
	solved=$(($solved+1))
	happy_test=$(($happy_test+1))
	;;

	[Nn])
	winner=$other
	loser=$wmCheck
	solved=$(($solved+1))
	wmCheck=$other
	happy_test=$(($happy_test+2))
		if [ $happy_test = 4 ]; then
		echo "GNOME vs KDE = No Winner"
		echo "Here are some other window managers :"
		echo "http://en.wikipedia.org/wiki/Window_manager"
		echo
		exit 0
		fi
	;;

	[Uu])

	solved=$(($solved+1))
	wmCheck=$other
	happy_test=$(($happy_test+3))
		if [ $happy_test -gt 5 ]; then
		echo "GNOME vs KDE = No Winner"
		echo "Information about GNOME and KDE :"
		echo "http://en.wikipedia.org/wiki/KDE"
		echo "http://en.wikipedia.org/wiki/GNOME"
		echo
		exit 0
		fi
	;;
esac

done
if [ "$happy_test" -gt 2 ]; then
echo "$winner is better than $loser"
echo
else
echo "GNOME vs KDE = No Winner"
echo
fi
exit 0
</pre>
]]></content:encoded>
			<wfw:commentRss>http://linux.blowshard.net/2007/03/05/bash-script-gnome-vs-kde/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bash Scripting : sha1sum</title>
		<link>http://linux.blowshard.net/2007/03/05/bash-scripting-sha1sum/</link>
		<comments>http://linux.blowshard.net/2007/03/05/bash-scripting-sha1sum/#comments</comments>
		<pubDate>Mon, 05 Mar 2007 12:06:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://linux.blowshard.net/?p=3</guid>
		<description><![CDATA[ When using echo to send text to sha1sum make sure you do it like this :
echo -n &#8220;abc123&#8243; &#124; sha1sum
and not
echo &#8220;abc123&#8243; &#124; sha1sum
Without the -n echo adds a new line to the text.  Like if you were to type abc123 then hit enter.
 Notice :
echo &#8220;abc123&#8243; &#124; sha1sum
61ee8b5601a84d5154387578466c8998848ba089
echo -n &#8220;abc123&#8243; &#124; sha1sum
6367c48dd193d56ea7b0baad25b19455e529f5ee
]]></description>
			<content:encoded><![CDATA[<p> When using echo to send text to sha1sum make sure you do it like this :</p>
<p>echo -n &#8220;abc123&#8243; | sha1sum</p>
<p>and not</p>
<p>echo &#8220;abc123&#8243; | sha1sum</p>
<p>Without the -n echo adds a new line to the text.  Like if you were to type abc123 then hit enter.</p>
<p><strong> Notice :</strong></p>
<p>echo &#8220;abc123&#8243; | sha1sum<br />
61ee8b5601a84d5154387578466c8998848ba089</p>
<p>echo -n &#8220;abc123&#8243; | sha1sum<br />
6367c48dd193d56ea7b0baad25b19455e529f5ee</p>
]]></content:encoded>
			<wfw:commentRss>http://linux.blowshard.net/2007/03/05/bash-scripting-sha1sum/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
