<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Shell Script Language &#8211; Use Perl, Not Bash</title>
	<atom:link href="http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/</link>
	<description>Linux - on the Desktop</description>
	<lastBuildDate>Wed, 09 May 2012 23:58:52 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: qgdoxl</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-5128</link>
		<dc:creator>qgdoxl</dc:creator>
		<pubDate>Wed, 09 May 2012 23:58:52 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-5128</guid>
		<description>I totally agree with VU as a sysadmin I run into shell scripts *all* the time.  

I do not have a developers background and I found myself really enjoying writing -scripts in bash.  Like VU said it is chunks of command line mixed in with some cool logic.

Then as the scripts got more and more complex I often find myself pulling at hair that is  just not there.  I often joke that if I had a mortal enemy I would call him syntax.

Now I am left wondering if I should learn a higher level language, would that help or confuse things.  As I do feel mostly comfortable with bash scripting but often still run into hurdles.</description>
		<content:encoded><![CDATA[<p>I totally agree with VU as a sysadmin I run into shell scripts *all* the time.  </p>
<p>I do not have a developers background and I found myself really enjoying writing -scripts in bash.  Like VU said it is chunks of command line mixed in with some cool logic.</p>
<p>Then as the scripts got more and more complex I often find myself pulling at hair that is  just not there.  I often joke that if I had a mortal enemy I would call him syntax.</p>
<p>Now I am left wondering if I should learn a higher level language, would that help or confuse things.  As I do feel mostly comfortable with bash scripting but often still run into hurdles.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: puddu</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-5014</link>
		<dc:creator>puddu</dc:creator>
		<pubDate>Wed, 08 Feb 2012 17:37:54 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-5014</guid>
		<description>#!/bin/bash

if [[ $value = 0 ]]; then
   echo &quot; value is = 0&quot;
fi</description>
		<content:encoded><![CDATA[<p>#!/bin/bash</p>
<p>if [[ $value = 0 ]]; then<br />
   echo &#8221; value is = 0&#8243;<br />
fi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-4998</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Mon, 26 Dec 2011 19:18:12 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-4998</guid>
		<description>Raj - I prefer to use
set -o nounset
(which I think is more readable / self-documenting). :)

You probably also want to look into the &quot;typeset -i&quot; (and synonymous &quot;integer&quot;) builtin, which will treat a variable as a number and throw an error if you attempt to store a non-numeric value.

The &quot;set -o errexit&quot; command is also useful, as that will cause your script to exit if any command fails without being trapped (by &quot;trapped&quot; I mean not the conditional in an if statement or of the form &quot;command &#124;&#124; action&quot;).</description>
		<content:encoded><![CDATA[<p>Raj &#8211; I prefer to use<br />
set -o nounset<br />
(which I think is more readable / self-documenting). <img src='http://lindesk.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>You probably also want to look into the &#8220;typeset -i&#8221; (and synonymous &#8220;integer&#8221;) builtin, which will treat a variable as a number and throw an error if you attempt to store a non-numeric value.</p>
<p>The &#8220;set -o errexit&#8221; command is also useful, as that will cause your script to exit if any command fails without being trapped (by &#8220;trapped&#8221; I mean not the conditional in an if statement or of the form &#8220;command || action&#8221;).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raj</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-4997</link>
		<dc:creator>Raj</dc:creator>
		<pubDate>Thu, 22 Dec 2011 18:59:23 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-4997</guid>
		<description>Update: I figured it out. We can enable strict variable checking in shell scripts (bash) by including the following in the script:

set -u

I tested and it works fine. It loudly complains if a variable is used before it is defined. 

Wish I had known this before!

I found this information at http://shrubbery.mynetgear.net/c/display/W/Start+off+with+a+shebang#Startoffwithashebang-Strictmode</description>
		<content:encoded><![CDATA[<p>Update: I figured it out. We can enable strict variable checking in shell scripts (bash) by including the following in the script:</p>
<p>set -u</p>
<p>I tested and it works fine. It loudly complains if a variable is used before it is defined. </p>
<p>Wish I had known this before!</p>
<p>I found this information at <a href="http://shrubbery.mynetgear.net/c/display/W/Start+off+with+a+shebang#Startoffwithashebang-Strictmode" rel="nofollow">http://shrubbery.mynetgear.net/c/display/W/Start+off+with+a+shebang#Startoffwithashebang-Strictmode</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raj</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-4996</link>
		<dc:creator>Raj</dc:creator>
		<pubDate>Thu, 22 Dec 2011 18:51:22 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-4996</guid>
		<description>Good discussions/brainstorming about perl vs bash scripting. One comment I have is about the &quot;strict&quot; variable checking in Perl. By using &quot;use strict&quot;, we can force perl to do strict variable checking i.e. if a variable is erroneously used (and it wasn&#039;t created in the first place), perl would loudly complain. This is very useful during development and to eliminate all those typos that could crrep into your code. 

I am wondering if there is a equivalent feature in bash? For example in bash if I do a typo in one of the variables I intend to use, bash would happily go on without complaining. But this would lead to serious and very hard to find bugs in the code, since the variable with the typo wasn&#039;t defined in the first place. I have struggled with this issue in bash. 

So still my question is, is there a way to do strict variable checking in shell scripts (particularly bash)? If not that is a major problem.</description>
		<content:encoded><![CDATA[<p>Good discussions/brainstorming about perl vs bash scripting. One comment I have is about the &#8220;strict&#8221; variable checking in Perl. By using &#8220;use strict&#8221;, we can force perl to do strict variable checking i.e. if a variable is erroneously used (and it wasn&#8217;t created in the first place), perl would loudly complain. This is very useful during development and to eliminate all those typos that could crrep into your code. </p>
<p>I am wondering if there is a equivalent feature in bash? For example in bash if I do a typo in one of the variables I intend to use, bash would happily go on without complaining. But this would lead to serious and very hard to find bugs in the code, since the variable with the typo wasn&#8217;t defined in the first place. I have struggled with this issue in bash. </p>
<p>So still my question is, is there a way to do strict variable checking in shell scripts (particularly bash)? If not that is a major problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lancaster</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-4930</link>
		<dc:creator>Lancaster</dc:creator>
		<pubDate>Sun, 26 Jun 2011 00:41:10 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-4930</guid>
		<description>Perl is ugly ... indeed, when compared to other languages like C or even python, not to shell scripts</description>
		<content:encoded><![CDATA[<p>Perl is ugly &#8230; indeed, when compared to other languages like C or even python, not to shell scripts</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-4874</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 07 Apr 2011 08:12:49 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-4874</guid>
		<description>All nonsense, real men use csh. ;-)</description>
		<content:encoded><![CDATA[<p>All nonsense, real men use csh. <img src='http://lindesk.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-4798</link>
		<dc:creator>Danny</dc:creator>
		<pubDate>Sat, 11 Dec 2010 17:05:04 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-4798</guid>
		<description>Jay - the O&#039;Reilly book on Bash is a really useful book to read.  While you can find a lot of information on the web about basic shell scripting, you have to look harder to gain an understanding of the more advanced string manipulation function, the special filehandles which allow you to make network connections, etc.  And on your comment about stuff in /bin being functions, you&#039;re not too far off - several things which are binaries in bin are actually overridden as builtins within the shell, so they&#039;re really more like functions and not like external binaries which have the fork/exec overhead you&#039;d expect.

Anyway, the book is a good place to find that info which basically shows you what you don&#039;t know, and then you can find more information on those topics (once you know what you&#039;re looking for) online.</description>
		<content:encoded><![CDATA[<p>Jay &#8211; the O&#8217;Reilly book on Bash is a really useful book to read.  While you can find a lot of information on the web about basic shell scripting, you have to look harder to gain an understanding of the more advanced string manipulation function, the special filehandles which allow you to make network connections, etc.  And on your comment about stuff in /bin being functions, you&#8217;re not too far off &#8211; several things which are binaries in bin are actually overridden as builtins within the shell, so they&#8217;re really more like functions and not like external binaries which have the fork/exec overhead you&#8217;d expect.</p>
<p>Anyway, the book is a good place to find that info which basically shows you what you don&#8217;t know, and then you can find more information on those topics (once you know what you&#8217;re looking for) online.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lee</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-4778</link>
		<dc:creator>Lee</dc:creator>
		<pubDate>Thu, 11 Nov 2010 16:03:16 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-4778</guid>
		<description>Does this satisfy the request?

sed &#039;s/oldText/newTest/g&#039; outfile.txt</description>
		<content:encoded><![CDATA[<p>Does this satisfy the request?</p>
<p>sed &#8216;s/oldText/newTest/g&#8217; outfile.txt</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jay</title>
		<link>http://lindesk.com/2008/05/shell-script-language-use-perl-not-bash/comment-page-1/#comment-4608</link>
		<dc:creator>jay</dc:creator>
		<pubDate>Fri, 19 Mar 2010 14:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://lindesk.com/?p=107#comment-4608</guid>
		<description>Found this after frustratingly trying to write such a simple bash script.
I haven&#039;t even been formally taught bash (or even formally introduced), but have been &quot;using&quot; it for years now.
I I still absolutely hate it. I have a programming background and can not come to grips with bash syntax. Whether or not this makes me a dunce - i do no care - bash KILLS my productivity. Reading vague man pages and messing with string manipulations just takes to much time. I like this article because it makes me feel like a real human again after suffering over the most simple scripts. Perl or python and don&#039;t look back! Shoot i can write these functions out in C in maybe 1/8 the time.
I really do want to use bash efficiently - but its far to annoying to bother with.

PS while using bash it&#039;s almost like everything in /bin is a function, or a library.
most programmers have their toolset of libraries they like to use; with scripting you have many choices of apps that do the same thing in different ways - compound that on the fact that man pages are often lacking or incomplete in information, and it is a real pain in the neck to find the right command to use in a script --- whereas a header file is easy to read.</description>
		<content:encoded><![CDATA[<p>Found this after frustratingly trying to write such a simple bash script.<br />
I haven&#8217;t even been formally taught bash (or even formally introduced), but have been &#8220;using&#8221; it for years now.<br />
I I still absolutely hate it. I have a programming background and can not come to grips with bash syntax. Whether or not this makes me a dunce &#8211; i do no care &#8211; bash KILLS my productivity. Reading vague man pages and messing with string manipulations just takes to much time. I like this article because it makes me feel like a real human again after suffering over the most simple scripts. Perl or python and don&#8217;t look back! Shoot i can write these functions out in C in maybe 1/8 the time.<br />
I really do want to use bash efficiently &#8211; but its far to annoying to bother with.</p>
<p>PS while using bash it&#8217;s almost like everything in /bin is a function, or a library.<br />
most programmers have their toolset of libraries they like to use; with scripting you have many choices of apps that do the same thing in different ways &#8211; compound that on the fact that man pages are often lacking or incomplete in information, and it is a real pain in the neck to find the right command to use in a script &#8212; whereas a header file is easy to read.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

