<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Seth-Group Corp  &#62;Blog!</title>
	<atom:link href="http://sethgroupcorp.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sethgroupcorp.wordpress.com</link>
	<description>El blog que deberia leer todo postulante a sethgrouper</description>
	<lastBuildDate>Wed, 01 Feb 2012 14:08:19 +0000</lastBuildDate>
	<language>es</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='sethgroupcorp.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Seth-Group Corp  &#62;Blog!</title>
		<link>http://sethgroupcorp.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://sethgroupcorp.wordpress.com/osd.xml" title="Seth-Group Corp  &#62;Blog!" />
	<atom:link rel='hub' href='http://sethgroupcorp.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Bash scripting Tutorial</title>
		<link>http://sethgroupcorp.wordpress.com/2012/02/01/bash-scripting-tutorial/</link>
		<comments>http://sethgroupcorp.wordpress.com/2012/02/01/bash-scripting-tutorial/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 14:06:49 +0000</pubDate>
		<dc:creator>Seth-Group Corp</dc:creator>
				<category><![CDATA[tech web]]></category>
		<category><![CDATA[argentina]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[corp]]></category>
		<category><![CDATA[group]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[scripting]]></category>
		<category><![CDATA[seth]]></category>
		<category><![CDATA[seth group]]></category>
		<category><![CDATA[seth group corp]]></category>
		<category><![CDATA[sethgroup]]></category>
		<category><![CDATA[tecnologia]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://sethgroupcorp.wordpress.com/?p=63</guid>
		<description><![CDATA[Bash scripting Tutorial<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sethgroupcorp.wordpress.com&amp;blog=16757777&amp;post=63&amp;subd=sethgroupcorp&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>En inglés pero muy intuitivo como es de esperarse en Linux</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<h2><a href="http://linuxconfig.org/Bash_scripting_Tutorial">Bash scripting Tutorial</a></h2>
<p>Last Updated on Wednesday, 02 November 2011 06:35</p>
<p>&nbsp;</p>
<table cellspacing="0" cellpadding="0">
<tbody>
<tr>
<th>Article Index</th>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#1-hello-world-bash-shell-script">1. Hello World Bash Shell Script</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#2-simple-backup-bash-shell-script">2. Simple Backup bash shell script</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#3-variables">3. Variables</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#3-1-global-vs-local-variables">3.1. Global vs. Local variables</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#4-passing-arguments-to-the-bash-script">4. Passing arguments to the bash script</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#5-executing-shell-commands-with-bash">5. Executing shell commands with bash</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#6-reading-user-input">6. Reading User Input</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#7-bash-trap-command">7. Bash Trap Command</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#8-arrays">8. Arrays</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#8-1-declare-simple-bash-array">8.1. Declare simple bash array</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#8-2-read-file-into-bash-array">8.2. Read file into bash array</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#9-bash-if--else--fi-statements">9. Bash if / else / fi statements</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#9-1-simple-bash-ifelse-statement">9.1. Simple Bash if/else statement</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#9-2-nested-ifelse">9.2. Nested if/else</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#10-bash-comparisons">10. Bash Comparisons</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#10-1-arithmetic-comparisons">10.1. Arithmetic Comparisons</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#10-2-string-comparisons">10.2. String Comparisons</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#11-bash-file-testing">11. Bash File Testing</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#12-loops">12. Loops</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#12-1-bash-for-loop">12.1. Bash for loop</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#12-2-bash-while-loop">12.2. Bash while loop</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#12-3-bash-until-loop">12.3. Bash until loop</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#12-4-control-bash-loop-with">12.4. Control bash loop with</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#13-bash-functions">13. Bash Functions</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#14-bash-select">14. Bash Select</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#15-case-statement-conditional">15. Case statement conditional</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#16-bash-quotes-and-quotations">16. Bash quotes and quotations</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#16-1-escaping-meta-characters">16.1. Escaping Meta characters</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#16-2-single-quotes">16.2. Single quotes</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#16-3-double-quotes">16.3. Double Quotes</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#16-4-bash-quoting-with-ansi-c-style">16.4. Bash quoting with ANSI-C style</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#17-arithmetic-operations">17. Arithmetic Operations</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#17-1-bash-addition-calculator-example">17.1. Bash Addition Calculator Example</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#17-2-bash-arithmetics">17.2. Bash Arithmetics</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#17-3-round-floating-point-number">17.3. Round floating point number</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#17-4-bash-floating-point-calculations">17.4. Bash floating point calculations</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#18-redirections">18. Redirections</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#18-1-stdout-from-bash-script-to-stderr">18.1. STDOUT from bash script to STDERR</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#18-2-stderr-from-bash-script-to-stdout">18.2. STDERR from bash script to STDOUT</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#18-3-stdout-to-screen">18.3. stdout to screen</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#18-4-stdout-to-file">18.4. stdout to file</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#18-5-stderr-to-file">18.5. stderr to file</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#18-6-stdout-to-stderr">18.6. stdout to stderr</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#18-7-stderr-to-stdout">18.7. stderr to stdout</a></td>
</tr>
<tr>
<td><a href="http://linuxconfig.org/Bash_scripting_Tutorial#18-8-stderr-and-stdout-to-file">18.8. stderr and stdout to file</a></td>
</tr>
<tr>
<td>
<hr />
<p><span style="color:#008000;"><br />
</span></td>
</tr>
</tbody>
</table>
<table border="0">
<tbody>
<tr>
<td style="text-align:center;"><a title="Bash Beginners Guide PDF Download" href="http://linuxconfig-org.tradepub.com/free/w_mach02#linux-offers" rel="nofollow" target="_self"><img src="http://linuxconfig.org/images/banners/bash.png" alt="Free BASH scripting guide DOWNLOAD" border="0" /></a><br />
<a title="Bash Scripting Beginners Guide PDF Download" href="http://linuxconfig-org.tradepub.com/free/w_mach02#linux-offers" rel="nofollow" target="_self">&gt;PDF DOWNLOAD&lt;</a><br />
<a title="Bash Scripting Guide PDF Download" href="http://linuxconfig-org.tradepub.com/free/w_advb01/?p=w_advb01#linux-offers" rel="nofollow" target="_self"><img src="http://linuxconfig.org/images/banners/re_tradepub-bash.png" alt="Free BASH scripting guide DOWNLOAD" border="0" /></a><br />
<a title="Bash Advandced Guide PDF Download" href="http://linuxconfig-org.tradepub.com/free/w_advb01/?p=w_advb01#linux-offers" rel="nofollow" target="_self">&gt;PDF DOWNLOAD&lt;</a></td>
<td>This bash script tutorial assumes no previous knowledge of bash scripting.As you will soon discover in this quick comprehensive bash scripting guide, learning the bash shell scripting is very easy task. However, if you do not find an answer to your questions by reading this bash tutorial or you need extra help, feel free to ask us on our new <a title="Linux Forum" href="http://forum.linuxcareer.com/" rel="nofollow" target="_blank">Linux Forum</a>. We will be more than happy to help you with your bash questions there.</p>
<p>Lets begin this bash scripting tutorial with a simple &#8220;Hello World&#8221; script. Let&#8217;s start with Learning the bash Shell: Unix Shell Programming</p>
<p><a title="Bash Scripting Beginners Guide PDF Download" href="http://linuxconfig-org.tradepub.com/free/w_mach02#linux-offers" rel="nofollow" target="_self">Bash Scripting <strong>Beginners</strong> Guide<br />
FREE PDF DOWNLOAD </a></p>
<p><a title="Bash Scripting Advanced Guide PDF Download" href="http://linuxconfig-org.tradepub.com/free/w_advb01/?p=w_advb01#linux-offers" rel="nofollow" target="_self">Bash Scripting <strong>Advanced</strong> Guide<br />
FREE PDF DOWNLOAD</a></td>
</tr>
</tbody>
</table>
<h1 id="1-hello-world-bash-shell-script">1. Hello World Bash Shell Script</h1>
<p><a href="http://linuxconfig.org/images/flash/bash.swf">http://linuxconfig.org/images/flash/bash.swf</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>First you need to find out where is your bash interpreter located. Enter the following into your command line:</p>
<p>&nbsp;</p>
<pre>$ which bash</pre>
<p><img title="Locate a Bash Interpreter" src="http://linuxconfig.org/images/locate-bash-interpreter.gif" alt="bash interpreter location: /bin/bash" width="188" height="43" border="0" /></p>
<p>Open up you favorite text editor and a create file called hello_world.sh. Insert the following lines to a file:</p>
<p>NOTE:Every bash shell script in this tutorial starts with <strong>shebang:&#8221;#!&#8221;</strong>which is not read as a comment. First line is also a place where you put your interpreter which is in this case: /bin/bash.</p>
<p>Here is our first bash shell script example:</p>
<pre>#!/bin/bash
# declare STRING variable
STRING="Hello World"
#print variable on a screen
echo $STRING
</pre>
<p>Navigate to a directory where your hello_world.sh is located and make the file executable:</p>
<pre>$ chmod +x hello_world.sh</pre>
<p><img title="Make bash shell script executable" src="http://linuxconfig.org/images/make-bash-script-executable.gif" alt="Make bash shell script executable" width="263" height="30" border="0" /></p>
<p>Now you are ready to execute your first bash script:</p>
<div id="s">
<pre>./hello_world.sh</pre>
</div>
<p><img title="Example of simple bash shell script" src="http://linuxconfig.org/images/Hellobash.gif" alt="Example of simple bash shell script" width="214" height="43" border="0" /></p>
<p>&nbsp;</p>
<h1 id="2-simple-backup-bash-shell-script">2. Simple Backup bash shell script</h1>
<div id="s">
<pre>#!/bin/bash
tar -czf myhome_directory.tar.gz /home/linuxconfig</pre>
</div>
<p><img title="Simple Backup bash script" src="http://linuxconfig.org/images/Bash-Simple-backup-script-example.gif" alt="Simple Backup bash script" border="0" /></p>
<h1 id="3-variables">3. Variables</h1>
<p>In this example we declare simple bash variable and print it on the screen ( stdout ) with echo command.</p>
<pre>#!/bin/bash
 STRING="HELLO WORLD!!!"
 echo $STRING</pre>
<p><img title="Bash string Variables in bash script" src="http://linuxconfig.org/images/Bash-string-Variables-bash-script.gif" alt="Bash string Variables in bash script" width="484" height="43" border="0" /></p>
<p>Your backup script and variables:</p>
<pre>#!/bin/bash
 OF=myhome_directory_$(date +%Y%m%d).tar.gz
 tar -czf $OF /home/linuxconfig</pre>
<p><img title="Bash backup Script with bash Variables" src="http://linuxconfig.org/images/Bash-backup-Script-bash-variables.gif" alt="Bash backup Script with bash Variables" width="484" height="69" border="0" /></p>
<h2 id="3-1-global-vs-local-variables">3.1. Global vs. Local variables</h2>
<pre>#!/bin/bash
#Define bash global variable
#This variable is global and can be used anywhere in this bash script
VAR="global variable"
function bash {
#Define bash local variable
#This variable is local to bash function only
local VAR="local variable"
echo $VAR
}
echo $VAR
bash
# Note the bash global variable did not change
# "local" is bash reserved word
echo $VAR</pre>
<p><img title="Global vs. Local Bash variables in bash script" src="http://linuxconfig.org/images/Bash-global-local-bash-variables-bash-script.gif" alt="Global vs. Local Bash variables in bash script" width="190" height="69" border="0" /></p>
<h1 id="4-passing-arguments-to-the-bash-script">4. Passing arguments to the bash script</h1>
<pre>#!/bin/bash
# use predefined variables to access passed arguments
#echo arguments to the shell
echo $1 $2 $3 ' -&gt; echo $1 $2 $3'

# We can also store arguments from bash command line in special array
args=("$@")
#echo arguments to the shell
echo ${args[0]} ${args[1]} ${args[2]} ' -&gt; args=("$@"); echo ${args[0]} ${args[1]} ${args[2]}'

#use $@ to print out all arguments at once
echo $@ ' -&gt; echo $@'

# use $# variable to print out
# number of arguments passed to the bash script
echo Number of arguments passed: $# ' -&gt; echo Number of arguments passed: $#'
/arguments.sh Bash Scripting Tutorial</pre>
<p><img title="Passing arguments to the bash script" src="http://linuxconfig.org/images/Passing-arguments-bash-script.gif" alt="Passing arguments to the bash script" width="472" height="82" border="0" /></p>
<h1 id="5-executing-shell-commands-with-bash">5. Executing shell commands with bash</h1>
<pre>#!/bin/bash
# use backticks " ` ` " to execute shell command
echo `uname -o`
# executing bash command without backticks
echo uname -o</pre>
<p><img title="Executing shell commands with bash" src="http://linuxconfig.org/images/Execute-shell-commands-within-bash-script.gif" alt="Executing shell commands with bash" width="220" height="82" border="0" /></p>
<h1 id="6-reading-user-input">6. Reading User Input</h1>
<pre>#!/bin/bash

echo -e "Hi, please type the word: \c "
read  word
echo "The word you entered is: $word"
echo -e "Can you please enter two words? "
read word1 word2
echo "Here is your input: \"$word1\" \"$word2\""
echo -e "How do you feel about bash scripting? "
# read command now stores a reply into the default build-in variable $REPLY
read
echo "You said $REPLY, I'm glad to hear that! "
echo -e "What are your favorite colours ? "
# -a makes read command to read into an array
read -a colours
echo "My favorite colours are also ${colours[0]}, ${colours[1]} and ${colours[2]}:-)"</pre>
<p><img title="Reading User Input with bash" src="http://linuxconfig.org/images/Reading-user-input-bash-script.gif" alt="Reading User Input with bash" width="322" height="173" border="0" /></p>
<h1 id="7-bash-trap-command">7. Bash Trap Command</h1>
<table border="0">
<tbody>
<tr>
<td>
<pre>#!/bin/bash
# bash trap command
trap bashtrap INT
# bash clear screen command
clear;
# bash trap function is executed when CTRL-C is pressed:
# bash prints message =&gt; Executing bash trap subrutine !
bashtrap()
{
    echo "CTRL+C Detected !...executing bash trap !"
}
# for loop from 1/10 to 10/10
for a in `seq 1 10`; do
    echo "$a/10 to Exit."
    sleep 1;
done
echo "Exit Bash Trap Example!!!"</pre>
</td>
<td width="300"><a href="http://linuxconfig.org/images/flash/bash_trap.swf">http://linuxconfig.org/images/flash/bash_trap.swf</a></td>
</tr>
</tbody>
</table>
<h1 id="8-arrays">8. Arrays</h1>
<h2 id="8-1-declare-simple-bash-array">8.1. Declare simple bash array</h2>
<pre>#!/bin/bash
#Declare array with 4 elements
ARRAY=( 'Debian Linux' 'Redhat Linux' Ubuntu Linux )
# get number of elements in the array
ELEMENTS=${#ARRAY[@]}

# echo each element in array
# for loop
for (( i=0;i&lt;$ELEMENTS;i++)); do
    echo ${ARRAY[${i}]}
done</pre>
<p><img title="Declare simple bash array" src="http://linuxconfig.org/images/declare-bash-array.gif" alt="Declare simple bash array" width="154" height="82" border="0" /></p>
<h2 id="8-2-read-file-into-bash-array">8.2. Read file into bash array</h2>
<div>
<pre>#!/bin/bash
# Declare array
declare -a ARRAY
# Link filedescriptor 10 with stdin
exec 10&lt;&amp;0
# stdin replaced with a file supplied as a first argument
exec &lt; $1
let count=0

while read LINE; do

    ARRAY[$count]=$LINE
    ((count++))
done

echo Number of elements: ${#ARRAY[@]}
# echo array's content
echo ${ARRAY[@]}
# restore stdin from filedescriptor 10
# and close filedescriptor 10
exec 0&lt;&amp;10 10&lt;&amp;-
</pre>
</div>
<p><strong>Bash script execution with an output:</strong></p>
<pre>linuxconfig.org $ cat bash.txt
Bash
Scripting
Tutorial
Guide
linuxconfig.org $ ./bash-script.sh bash.txt
Number of elements: 4
Bash Scripting Tutorial Guide
linuxconfig.org $</pre>
<h1 id="9-bash-if--else--fi-statements">9. Bash if / else / fi statements</h1>
<h2 id="9-1-simple-bash-ifelse-statement">9.1. Simple Bash if/else statement</h2>
<p>Please note the spacing inside the [ and ] brackets! Without the spaces, it won&#8217;t work!</p>
<pre>#!/bin/bash
directory="./BashScripting"

# bash check if directory exists
if [ -d $directory ]; then
	echo "Directory exists"
else
	echo "Directory does not exists"
fi</pre>
<p><img title="Bash if else fi statement" src="http://linuxconfig.org/images/bash-if-else-fi-statement.gif" alt="Bash if else fi statement" width="232" height="82" border="0" /></p>
<h2 id="9-2-nested-ifelse">9.2. Nested if/else</h2>
<pre>#!/bin/bash

# Declare variable choice and assign value 4
choice=4
# Print to stdout
 echo "1. Bash"
 echo "2. Scripting"
 echo "3. Tutorial"
 echo -n "Please choose a word [1,2 or 3]? "
# Loop while the variable choice is equal 4
# bash while loop
while [ $choice -eq 4 ]; do

# read user input
read choice
# bash nested if/else
if [ $choice -eq 1 ] ; then

        echo "You have chosen word: Bash"

else                   

        if [ $choice -eq 2 ] ; then
                 echo "You have chosen word: Scripting"
        else

                if [ $choice -eq 3 ] ; then
                        echo "You have chosen word: Tutorial"
                else
                        echo "Please make a choice between 1-3 !"
                        echo "1. Bash"
                        echo "2. Scripting"
                        echo "3. Tutorial"
                        echo -n "Please choose a word [1,2 or 3]? "
                        choice=4
                fi
        fi
fi
done</pre>
<p><img title="Nested Bash if else statement" src="http://linuxconfig.org/images/bash-if-else-nested-statement.gif" alt="Nested Bash if else statement" width="232" height="160" border="0" /></p>
<h1 id="10-bash-comparisons">10. Bash Comparisons</h1>
<h2 id="10-1-arithmetic-comparisons">10.1. Arithmetic Comparisons</h2>
<table border="1">
<tbody>
<tr>
<td width="50">-lt</td>
<td width="50">&lt;</td>
</tr>
<tr>
<td width="50">-gt</td>
<td width="50">&gt;</td>
</tr>
<tr>
<td width="50">-le</td>
<td width="50">&lt;=</td>
</tr>
<tr>
<td width="50">-ge</td>
<td width="50">&gt;=</td>
</tr>
<tr>
<td width="50">-eq</td>
<td width="50">==</td>
</tr>
<tr>
<td width="50">-ne</td>
<td width="50">!=</td>
</tr>
</tbody>
</table>
<pre>#!/bin/bash
# declare integers
NUM1=2
NUM2=2
if [ $NUM1 -eq $NUM2 ]; then
	echo "Both Values are equal"
else
	echo "Values are NOT equal"
fi</pre>
<p><img title="Bash Arithmetic Comparisons" src="http://linuxconfig.org/images/bash_arithmetic-comparisons-equal.gif" alt="Bash Arithmetic Comparisons" width="484" height="43" border="0" /></p>
<pre>#!/bin/bash
# declare integers
NUM1=2
NUM2=1
if [ $NUM1 -eq $NUM2 ]; then
	echo "Both Values are equal"
else
	echo "Values are NOT equal"
fi</pre>
<p><img title="Bash Arithmetic Comparisons - values are NOT equal" src="http://linuxconfig.org/images/bash_arithmetic-comparisons-not-equal.gif" alt="Bash Arithmetic Comparisons - values are NOT equal" width="484" height="43" border="0" /></p>
<pre>#!/bin/bash
# declare integers
NUM1=2
NUM2=1
if   [ $NUM1 -eq $NUM2 ]; then
	echo "Both Values are equal"
elif [ $NUM1 -gt $NUM2 ]; then
	echo "NUM1 is greater then NUM2"
else
	echo "NUM2 is greater then NUM1"
fi</pre>
<p><img title="Bash Arithmetic Comparisons - greater then" src="http://linuxconfig.org/images/bash_arithmetic-comparisons-greater-then.gif" alt="Bash Arithmetic Comparisons - greater then" width="370" height="43" border="0" /></p>
<h2 id="10-2-string-comparisons">10.2. String Comparisons</h2>
<table border="1">
<tbody>
<tr>
<td width="50">=</td>
<td width="200">equal</td>
</tr>
<tr>
<td width="50">!=</td>
<td width="50">not equal</td>
</tr>
<tr>
<td width="50">&lt;</td>
<td width="50">less then</td>
</tr>
<tr>
<td width="50">&gt;</td>
<td width="50">greater then</td>
</tr>
<tr>
<td width="50">-n s1</td>
<td width="50">string s1 is not empty</td>
</tr>
<tr>
<td width="50">-z s1</td>
<td width="50">string s1 is empty</td>
</tr>
</tbody>
</table>
<pre>#!/bin/bash
#Declare string S1
S1="Bash"
#Declare string S2
S2="Scripting"
if [ $S1 = $S2 ]; then
	echo "Both Strings are equal"
else
	echo "Strings are NOT equal"
fi</pre>
<p><img title="Bash String Comparisons - values are NOT equal" src="http://linuxconfig.org/images/bash-string-comparisons-values-NOT-equal.gif" alt="Bash String Comparisons - values are NOT equal" width="370" height="43" border="0" /></p>
<pre>#!/bin/bash
#Declare string S1
S1="Bash"
#Declare string S2
S2="Bash"
if [ $S1 = $S2 ]; then
	echo "Both Strings are equal"
else
	echo "Strings are NOT equal"
fi</pre>
<p><img title="Locate a Bash Interpreter" src="http://linuxconfig.org/images/bash-string-comparisons-values-equal.gif" alt="bash interpreter location: /bin/bash" width="370" height="43" border="0" /></p>
<h1 id="11-bash-file-testing">11. Bash File Testing</h1>
<table border="0">
<tbody>
<tr>
<td width="140">-b filename</td>
<td width="500">Block special file</td>
</tr>
<tr>
<td width="100">-c filename</td>
<td width="300">Special character file</td>
</tr>
<tr>
<td width="100">-d directoryname</td>
<td width="300">Check for directory existence</td>
</tr>
<tr>
<td width="100">-e filename</td>
<td width="300">Check for file existence</td>
</tr>
<tr>
<td width="100">-f filename</td>
<td width="300">Check for regular file existence not a directory</td>
</tr>
<tr>
<td width="100">-G filename</td>
<td width="300">Check if file exists and is owned by effective group ID.</td>
</tr>
<tr>
<td width="100">-g filename</td>
<td width="300">true if file exists and is set-group-id.</td>
</tr>
<tr>
<td width="100">-k filename</td>
<td width="300">Sticky bit</td>
</tr>
<tr>
<td width="100">-L filename</td>
<td width="300">Symbolic link</td>
</tr>
<tr>
<td width="100">-O filename</td>
<td width="300">True if file exists and is owned by the effective user id.</td>
</tr>
<tr>
<td width="100">-r filename</td>
<td width="300">Check if file is a readable</td>
</tr>
<tr>
<td width="100">-S filename</td>
<td width="300">Check if file is socket</td>
</tr>
<tr>
<td width="100">-s filename</td>
<td width="300">Check if file is nonzero size</td>
</tr>
<tr>
<td width="100">-u filename</td>
<td width="300">Check if file set-ser-id bit is set</td>
</tr>
<tr>
<td width="100">-w filename</td>
<td width="300">Check if file is writable</td>
</tr>
<tr>
<td width="100">-x filename</td>
<td width="300">Check if file is executable</td>
</tr>
</tbody>
</table>
<pre>#!/bin/bash
file="./file"
if [ -e $file ]; then
	echo "File exists"
else
	echo "File does not exists"
fi</pre>
<p><img title="Bash File Testing - File does not exist" src="http://linuxconfig.org/images/bash-file-testing-file-does-not-exist.gif" alt="Bash File Testing - File does not exist" width="370" height="43" border="0" /> <img title="Bash File Testing - File exists" src="http://linuxconfig.org/images/bash-file-testing-file-exist.gif" alt="Bash File Testing - File exists" width="370" height="82" border="0" /></p>
<p>Similarly for example we can use while loop to check if file does not exists. This script will sleep until file does exists. Note bash negator &#8220;!&#8221; which negates the -e option.</p>
<pre>#!/bin/bash

while [ ! -e myfile ]; do
# Sleep until file does exists/is created
sleep 1
done</pre>
<h1 id="12-loops">12. Loops</h1>
<h2 id="12-1-bash-for-loop">12.1. Bash for loop</h2>
<pre>#!/bin/bash

# bash for loop
for f in $( ls /var/ ); do
	echo $f
done</pre>
<p>Running for loop from bash shell command line:</p>
<pre>$ for f in $( ls /var/ ); do echo $f; done</pre>
<p><img title="Bash for loop" src="http://linuxconfig.org/images/bash-for-loop.gif" alt="Bash for loop" width="484" height="173" border="0" /></p>
<h2 id="12-2-bash-while-loop">12.2. Bash while loop</h2>
<pre>#!/bin/bash
COUNT=6
# bash while loop
while [ $COUNT -gt 0 ]; do
	echo Value of count is: $COUNT
	let COUNT=COUNT-1
done</pre>
<p><img title="Bash while loop" src="http://linuxconfig.org/images/bash-while-loop.gif" alt="Bash while loop" width="484" height="108" border="0" /></p>
<h2 id="12-3-bash-until-loop">12.3. Bash until loop</h2>
<pre>#!/bin/bash
COUNT=0
# bash until loop
until [ $COUNT -gt 5 ]; do
        echo Value of count is: $COUNT
        let COUNT=COUNT+1
done</pre>
<p><img title="Bash until loop" src="http://linuxconfig.org/images/bash-until-loop.gif" alt="Bash until loop" width="484" height="108" border="0" /></p>
<h2 id="12-4-control-bash-loop-with">12.4. Control bash loop with</h2>
<p>Here is a example of while loop controlled by standard input. Until the redirection chain from STDOUT to STDIN to the read command exists the while loop continues.</p>
<pre>#!/bin/bash
# This bash script will locate and replace spaces
# in the filenames
DIR="."
# Controlling a loop with bash read command by redirecting STDOUT as
# a STDIN to while loop
# find will not truncate filenames containing spaces
find $DIR -type f | while read file; do
# using POSIX class [:space:] to find space in the filename
if [[ "$file" = *[[:space:]]* ]]; then
# substitute space with "_" character and consequently rename the file
mv "$file" `echo $file | tr ' ' '_'`
fi;
# end of while loop
done</pre>
<p><img title="Bash script to replace spaces in the filenames with _" src="http://linuxconfig.org/images/Rename_files_containing_spaces.gif" alt="Bash script to replace spaces in the filenames with _" width="442" height="160" border="0" /></p>
<h1 id="13-bash-functions">13. Bash Functions</h1>
<pre>!/bin/bash
# BASH FUNCTIONS CAN BE DECLARED IN ANY ORDER
function function_B {
        echo Function B.
}
function function_A {
        echo $1
}
function function_D {
        echo Function D.
}
function function_C {
        echo $1
}
# FUNCTION CALLS
# Pass parameter to function A
function_A "Function A."
function_B
# Pass parameter to function C
function_C "Function C."
function_D</pre>
<p><img title="Bash Functions" src="http://linuxconfig.org/images/bash-functions.gif" alt="Bash Functions" width="484" height="82" border="0" /></p>
<h1 id="14-bash-select">14. Bash Select</h1>
<pre>#!/bin/bash

PS3='Choose one word: ' 

# bash select
select word in "linux" "bash" "scripting" "tutorial"
do
  echo "The word you have selected is: $word"
# Break, otherwise endless loop
  break
done

exit 0</pre>
<p><img title="Bash Select" src="http://linuxconfig.org/images/bash_select.gif" alt="Bash Select" width="214" height="108" border="0" /></p>
<h1 id="15-case-statement-conditional">15. Case statement conditional</h1>
<pre>#!/bin/bash
echo "What is your preferred programming / scripting language"
echo "1) bash"
echo "2) perl"
echo "3) phyton"
echo "4) c++"
echo "5) I do not know !"
read case;
#simple case bash structure
# note in this case $case is variable and does not have to
# be named case this is just an example
case $case in
    1) echo "You selected bash";;
    2) echo "You selected perl";;
    3) echo "You selected phyton";;
    4) echo "You selected c++";;
    5) exit
esac</pre>
<p><img title="bash case statement conditiona" src="http://linuxconfig.org/images/Bash_case_statement.gif" alt="bash case statement conditiona" width="340" height="134" border="0" /></p>
<h1 id="16-bash-quotes-and-quotations">16. Bash quotes and quotations</h1>
<p>Quotations and quotes are important part of bash and bash scripting. Here are some bash quotes and quotations basics.</p>
<h2 id="16-1-escaping-meta-characters">16.1. Escaping Meta characters</h2>
<p>Before we start with quotes and quotations we should know something about escaping meta characters. Escaping will suppress a special meaning of meta characters and therefore meta characters will be read by bash literally. To do this we need to use backslash &#8220;\&#8221; character. Example:</p>
<pre>#!/bin/bash

#Declare bash string variable
BASH_VAR="Bash Script"

# echo variable BASH_VAR
echo $BASH_VAR

#when meta character such us "$" is escaped with "\" it will be read literally
echo \$BASH_VAR 

# backslash has also special meaning and it can be suppressed with yet another "\"
echo "\\"</pre>
<p><img title="escaping meta characters in bash" src="http://linuxconfig.org/images/Escaping_meta.gif" alt="escaping meta characters in bash" width="202" height="69" border="0" /></p>
<h2 id="16-2-single-quotes">16.2. Single quotes</h2>
<p>Single quotes in bash will suppress special meaning of every meta characters. Therefore meta characters will be read literally. It is not possible to use another single quote within two single quotes not even if the single quote is escaped by backslash.</p>
<pre>#!/bin/bash

 #Declare bash string variable
 BASH_VAR="Bash Script"

 # echo variable BASH_VAR
 echo $BASH_VAR

 # meta characters special meaning in bash is suppressed when  using single quotes
 echo '$BASH_VAR  "$BASH_VAR"'</pre>
<p><img title="Using single quotes in bash" src="http://linuxconfig.org/images/Bash_single_quotes.gif" alt="Using single quotes in bash" width="214" height="56" border="0" /></p>
<h2 id="16-3-double-quotes">16.3. Double Quotes</h2>
<p>Double quotes in bash will suppress special meaning of every meta characters except &#8220;$&#8221;, &#8220;\&#8221; and &#8220;`&#8221;. Any other meta characters will be read literally. It is also possible to use single quote within double quotes. If we need to use double quotes within double quotes bash can read them literally when escaping them with &#8220;\&#8221;. Example:</p>
<pre>#!/bin/bash

#Declare bash string variable
BASH_VAR="Bash Script"

# echo variable BASH_VAR
echo $BASH_VAR

# meta characters and its special meaning in bash is
# suppressed when using double quotes except "$", "\" and "`"

echo "It's $BASH_VAR  and \"$BASH_VAR\" using backticks: `date`"</pre>
<p><img title="Using double quotes in bash" src="http://linuxconfig.org/images/Bash_double_quotes.gif" alt="Using double quotes in bash" width="490" height="56" border="0" /></p>
<h2 id="16-4-bash-quoting-with-ansi-c-style">16.4. Bash quoting with ANSI-C style</h2>
<p>There is also another type of quoting and that is ANSI-C. In this type of quoting characters escaped with &#8220;\&#8221; will gain special meaning according to the ANSI-C standard.</p>
<table border="1">
<tbody>
<tr>
<td width="50">\a</td>
<td width="250">alert (bell)</td>
<td width="50">\b</td>
<td width="250">backspace</td>
</tr>
<tr>
<td width="50">\e</td>
<td width="250">an escape character</td>
<td width="50">\f</td>
<td width="250">form feed</td>
</tr>
<tr>
<td width="50">\n</td>
<td width="250">newline</td>
<td width="50">\r</td>
<td width="250">carriage return</td>
</tr>
<tr>
<td width="50">\t</td>
<td width="250">horizontal tab</td>
<td width="50">\v</td>
<td width="250">vertical tab</td>
</tr>
<tr>
<td width="50">\\</td>
<td width="250">backslash</td>
<td width="50">\`</td>
<td width="250">single quote</td>
</tr>
<tr>
<td width="50">\nnn</td>
<td width="250">octal value of characters ( see [http://www.asciitable.com/ ASCII table] )</td>
<td width="50">\xnn</td>
<td width="250">hexadecimal value of characters ( see [http://www.asciitable.com/ ASCII table] )</td>
</tr>
</tbody>
</table>
<p>The syntax fo ansi-c bash quoting is: $&#8221; . Here is an example:</p>
<pre>#!/bin/bash

# as a example we have used \n as a new line, \x40 is hex value for @
# and \56 is octal value for .
echo $'web: www.linuxconfig.org\nemail: web\x40linuxconfig\56org'</pre>
<p><img title="quoting in bash with ansi-c stype" src="http://linuxconfig.org/images/Ansi-c_bash.gif" alt="quoting in bash with ansi-c stype" width="202" height="56" border="0" /></p>
<h1 id="17-arithmetic-operations">17. Arithmetic Operations</h1>
<h2 id="17-1-bash-addition-calculator-example">17.1. Bash Addition Calculator Example</h2>
<pre>#!/bin/bash

let RESULT1=$1+$2
echo $1+$2=$RESULT1 ' -&gt; # let RESULT1=$1+$2'
declare -i RESULT2
RESULT2=$1+$2
echo $1+$2=$RESULT2 ' -&gt; # declare -i RESULT2; RESULT2=$1+$2'
echo $1+$2=$(($1 + $2)) ' -&gt; # $(($1 + $2))'</pre>
<p><img title="Bash Addition Calculator" src="http://linuxconfig.org/images/Bash_addition_calc.gif" alt="Bash Addition Calculator" width="304" height="69" border="0" /></p>
<h2 id="17-2-bash-arithmetics">17.2. Bash Arithmetics</h2>
<pre>#!/bin/bash

echo '### let ###'
# bash addition
let ADDITION=3+5
echo "3 + 5 =" $ADDITION

# bash subtraction
let SUBTRACTION=7-8
echo "7 - 8 =" $SUBTRACTION 

# bash multiplication
let MULTIPLICATION=5*8
echo "5 * 8 =" $MULTIPLICATION

# bash division
let DIVISION=4/2
echo "4 / 2 =" $DIVISION

# bash modulus
let MODULUS=9%4
echo "9 % 4 =" $MODULUS

# bash power of two
let POWEROFTWO=2**2
echo "2 ^ 2 =" $POWEROFTWO

echo '### Bash Arithmetic Expansion ###'
# There are two formats for arithmetic expansion: $[ expression ]
# and $(( expression #)) its your choice which you use

echo 4 + 5 = $((4 + 5))
echo 7 - 7 = $[ 7 - 7 ]
echo 4 x 6 = $((3 * 2))
echo 6 / 3 = $((6 / 3))
echo 8 % 7 = $((8 % 7))
echo 2 ^ 8 = $[ 2 ** 8 ]

echo '### Declare ###'

echo -e "Please enter two numbers \c"
# read user input
read num1 num2
declare -i result
result=$num1+$num2
echo "Result is:$result "

# bash convert binary number 10001
result=2#10001
echo $result

# bash convert octal number 16
result=8#16
echo $result

# bash convert hex number 0xE6A
result=16#E6A
echo $result</pre>
<p><img title="Bash Arithmetic Operations" src="http://linuxconfig.org/images/bash-arithmetic_operations.gif" alt="Bash Arithmetic Operations" width="262" height="290" border="0" /></p>
<h2 id="17-3-round-floating-point-number">17.3. Round floating point number</h2>
<pre>#!/bin/bash
# get floating point number
floating_point_number=3.3446
echo $floating_point_number
# round floating point number with bash
for bash_rounded_number in $(printf %.0f $floating_point_number); do
echo "Rounded number with bash:" $bash_rounded_number
done</pre>
<p><img title="Round floating point number with bash" src="http://linuxconfig.org/images/Bash_round_floating_point_number.gif" alt="Round floating point number with bash" width="178" height="56" border="0" /></p>
<h2 id="17-4-bash-floating-point-calculations">17.4. Bash floating point calculations</h2>
<pre>#!/bin/bash
# Simple linux bash calculator
echo "Enter input:"
read userinput
echo "Result with 2 digits after decimal point:"
echo "scale=2; ${userinput}" | bc
echo "Result with 10 digits after decimal point:"
echo "scale=10; ${userinput}" | bc
echo "Result as rounded integer:"
echo $userinput | bc</pre>
<p><img title="Bash floating point calculations" src="http://linuxconfig.org/images/Bash_floating_point.gif" alt="Bash floating point calculations" width="256" height="134" border="0" /></p>
<h1 id="18-redirections">18. Redirections</h1>
<h2 id="18-1-stdout-from-bash-script-to-stderr">18.1. STDOUT from bash script to STDERR</h2>
<pre>#!/bin/bash

 echo "Redirect this STDOUT to STDERR" 1&gt;&amp;2</pre>
<p>To prove that STDOUT is redirected to STDERR we can redirect script&#8217;s output to file:<br />
<img title="STDOUT from bash script to STDERR" src="http://linuxconfig.org/images/STDOUTtoSTDERR.gif" alt="STDOUT from bash script to STDERR" width="286" height="147" border="0" /></p>
<h2 id="18-2-stderr-from-bash-script-to-stdout">18.2. STDERR from bash script to STDOUT</h2>
<pre>#!/bin/bash

 cat $1 2&gt;&amp;1</pre>
<p>To prove that STDERR is redirected to STDOUT we can redirect script&#8217;s output to file:<br />
<img title="STDERR from bash script to STDOUT" src="http://linuxconfig.org/images/STDERRtoSTDOUT.gif" alt="STDERR from bash script to STDOUT" width="358" height="147" border="0" /></p>
<h2 id="18-3-stdout-to-screen">18.3. stdout to screen</h2>
<p>The simple way to redirect a standard output ( stdout ) is to simply use any command, because by default stdout is automatically redirected to screen. First create a file &#8220;file1&#8243;:</p>
<pre>$ touch file1
$ ls file1
file1</pre>
<p>As you can see from the example above execution of ls command produces STDOUT which by default is redirected to screen.</p>
<h2 id="18-4-stdout-to-file">18.4. stdout to file</h2>
<p>The override the default behavior of STDOUT we can use &#8220;&gt;&#8221; to redirect this output to file:</p>
<pre>$ ls file1 &gt; STDOUT
$ cat STDOUT
file1</pre>
<h2 id="18-5-stderr-to-file">18.5. stderr to file</h2>
<p>By default STDERR is displayed on the screen:</p>
<pre>$ ls
file1  STDOUT
$ ls file2
ls: cannot access file2: No such file or directory</pre>
<p>In the following example we will redirect the standard error ( stderr ) to a file and stdout to a screen as default. Please note that STDOUT is displayed on the screen, however STDERR is redirected to a file called STDERR:</p>
<pre>$ ls
file1  STDOUT
$ ls file1 file2 2&gt; STDERR
file1
$ cat STDERR
ls: cannot access file2: No such file or directory</pre>
<h2 id="18-6-stdout-to-stderr">18.6. stdout to stderr</h2>
<p>It is also possible to redirect STDOUT and STDERR to the same file. In the next example we will redirect STDOUT to the same descriptor as STDERR. Both STDOUT and STDERR will be redirected to file &#8220;STDERR_STDOUT&#8221;.</p>
<pre>$ ls
file1  STDERR  STDOUT
$ ls file1 file2 2&gt; STDERR_STDOUT 1&gt;&amp;2
$ cat STDERR_STDOUT
ls: cannot access file2: No such file or directory
file1</pre>
<p>File STDERR_STDOUT now contains STDOUT and STDERR.</p>
<h2 id="18-7-stderr-to-stdout">18.7. stderr to stdout</h2>
<p>The above example can be reversed by redirecting STDERR to the same descriptor as SDTOUT:</p>
<pre>$ ls
file1  STDERR  STDOUT
$ ls file1 file2 &gt; STDERR_STDOUT 2&gt;&amp;1
$ cat STDERR_STDOUT
ls: cannot access file2: No such file or directory
file1</pre>
<h2 id="18-8-stderr-and-stdout-to-file">18.8. stderr and stdout to file</h2>
<p>Previous two examples redirected both STDOUT and STDERR to a file. Another way to achieve the same effect is illustrated below:</p>
<pre>$ ls
file1  STDERR  STDOUT
$ ls file1 file2 &amp;&gt; STDERR_STDOUT
$ cat STDERR_STDOUT
ls: cannot access file2: No such file or directory
file1</pre>
<p>or</p>
<pre>ls file1 file2 &gt;&amp; STDERR_STDOUT
$ cat STDERR_STDOUT
ls: cannot access file2: No such file or directory
file1</pre>
<div id="itp-social-buttons-box">
<h4>Share this linux post:</h4>
<p><a title="Submit Bash scripting Tutorial in Delicious" href="http://del.icio.us/post?url=http://linuxconfig.org/Bash_scripting_Tutorial&amp;title=Bash%20scripting%20Tutorial" rel="nofollow" target="blank"><img src="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/delicious.png" alt="Submit Bash scripting Tutorial in Delicious" /> </a><a title="Submit Bash scripting Tutorial in Digg" href="http://digg.com/submit?url=http://linuxconfig.org/Bash_scripting_Tutorial&amp;title=Bash%20scripting%20Tutorial" rel="nofollow" target="blank"><img src="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/digg.png" alt="Submit Bash scripting Tutorial in Digg" /> </a><a title="Submit Bash scripting Tutorial in FaceBook" href="http://www.facebook.com/sharer.php?u=http://linuxconfig.org/Bash_scripting_Tutorial&amp;t=Bash%20scripting%20Tutorial" rel="nofollow" target="blank"><img src="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/facebook.png" alt="Submit Bash scripting Tutorial in FaceBook" /> </a><a title="Submit Bash scripting Tutorial in Google Bookmarks" href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http://linuxconfig.org/Bash_scripting_Tutorial" rel="nofollow" target="blank"><img src="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/google.png" alt="Submit Bash scripting Tutorial in Google Bookmarks" /> </a><a title="Submit Bash scripting Tutorial in Stumbleupon" href="http://www.stumbleupon.com/submit?url=http://linuxconfig.org/Bash_scripting_Tutorial&amp;title=Bash%20scripting%20Tutorial" rel="nofollow" target="blank"><img src="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/stumbleupon.png" alt="Submit Bash scripting Tutorial in Stumbleupon" /> </a><a title="Submit Bash scripting Tutorial in Technorati" href="http://technorati.com/faves?add=http://linuxconfig.org/Bash_scripting_Tutorial" rel="nofollow" target="blank"><img src="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/technorati.png" alt="Submit Bash scripting Tutorial in Technorati" /> </a><a title="Submit Bash scripting Tutorial in Twitter" href="http://twitter.com/?status=Bash%20scripting%20Tutorial%20http%3A%2F%2Flinuxconfig.org%2FBash_scripting_Tutorial" rel="nofollow" target="blank"><img src="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/twitter.png" alt="Submit Bash scripting Tutorial in Twitter" /></a></div>
<br />Filed under: <a href='http://sethgroupcorp.wordpress.com/category/tech-web/'>tech web</a> Tagged: <a href='http://sethgroupcorp.wordpress.com/tag/argentina/'>argentina</a>, <a href='http://sethgroupcorp.wordpress.com/tag/bash/'>Bash</a>, <a href='http://sethgroupcorp.wordpress.com/tag/corp/'>corp</a>, <a href='http://sethgroupcorp.wordpress.com/tag/group/'>group</a>, <a href='http://sethgroupcorp.wordpress.com/tag/internet/'>internet</a>, <a href='http://sethgroupcorp.wordpress.com/tag/linux/'>linux</a>, <a href='http://sethgroupcorp.wordpress.com/tag/scripting/'>scripting</a>, <a href='http://sethgroupcorp.wordpress.com/tag/seth/'>seth</a>, <a href='http://sethgroupcorp.wordpress.com/tag/seth-group/'>seth group</a>, <a href='http://sethgroupcorp.wordpress.com/tag/seth-group-corp-2/'>seth group corp</a>, <a href='http://sethgroupcorp.wordpress.com/tag/sethgroup/'>sethgroup</a>, <a href='http://sethgroupcorp.wordpress.com/tag/tecnologia/'>tecnologia</a>, <a href='http://sethgroupcorp.wordpress.com/tag/tutorial/'>Tutorial</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sethgroupcorp.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sethgroupcorp.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sethgroupcorp.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sethgroupcorp.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/sethgroupcorp.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/sethgroupcorp.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/sethgroupcorp.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/sethgroupcorp.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sethgroupcorp.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sethgroupcorp.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sethgroupcorp.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sethgroupcorp.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sethgroupcorp.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sethgroupcorp.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sethgroupcorp.wordpress.com&amp;blog=16757777&amp;post=63&amp;subd=sethgroupcorp&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://sethgroupcorp.wordpress.com/2012/02/01/bash-scripting-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d5a594933dbb52a7d64daee1739efdd5?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sethgroupcorp</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/banners/bash.png" medium="image">
			<media:title type="html">Free BASH scripting guide DOWNLOAD</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/banners/re_tradepub-bash.png" medium="image">
			<media:title type="html">Free BASH scripting guide DOWNLOAD</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/locate-bash-interpreter.gif" medium="image">
			<media:title type="html">Locate a Bash Interpreter</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/make-bash-script-executable.gif" medium="image">
			<media:title type="html">Make bash shell script executable</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Hellobash.gif" medium="image">
			<media:title type="html">Example of simple bash shell script</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash-Simple-backup-script-example.gif" medium="image">
			<media:title type="html">Simple Backup bash script</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash-string-Variables-bash-script.gif" medium="image">
			<media:title type="html">Bash string Variables in bash script</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash-backup-Script-bash-variables.gif" medium="image">
			<media:title type="html">Bash backup Script with bash Variables</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash-global-local-bash-variables-bash-script.gif" medium="image">
			<media:title type="html">Global vs. Local Bash variables in bash script</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Passing-arguments-bash-script.gif" medium="image">
			<media:title type="html">Passing arguments to the bash script</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Execute-shell-commands-within-bash-script.gif" medium="image">
			<media:title type="html">Executing shell commands with bash</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Reading-user-input-bash-script.gif" medium="image">
			<media:title type="html">Reading User Input with bash</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/declare-bash-array.gif" medium="image">
			<media:title type="html">Declare simple bash array</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-if-else-fi-statement.gif" medium="image">
			<media:title type="html">Bash if else fi statement</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-if-else-nested-statement.gif" medium="image">
			<media:title type="html">Nested Bash if else statement</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash_arithmetic-comparisons-equal.gif" medium="image">
			<media:title type="html">Bash Arithmetic Comparisons</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash_arithmetic-comparisons-not-equal.gif" medium="image">
			<media:title type="html">Bash Arithmetic Comparisons - values are NOT equal</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash_arithmetic-comparisons-greater-then.gif" medium="image">
			<media:title type="html">Bash Arithmetic Comparisons - greater then</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-string-comparisons-values-NOT-equal.gif" medium="image">
			<media:title type="html">Bash String Comparisons - values are NOT equal</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-string-comparisons-values-equal.gif" medium="image">
			<media:title type="html">Locate a Bash Interpreter</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-file-testing-file-does-not-exist.gif" medium="image">
			<media:title type="html">Bash File Testing - File does not exist</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-file-testing-file-exist.gif" medium="image">
			<media:title type="html">Bash File Testing - File exists</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-for-loop.gif" medium="image">
			<media:title type="html">Bash for loop</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-while-loop.gif" medium="image">
			<media:title type="html">Bash while loop</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-until-loop.gif" medium="image">
			<media:title type="html">Bash until loop</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Rename_files_containing_spaces.gif" medium="image">
			<media:title type="html">Bash script to replace spaces in the filenames with _</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-functions.gif" medium="image">
			<media:title type="html">Bash Functions</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash_select.gif" medium="image">
			<media:title type="html">Bash Select</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash_case_statement.gif" medium="image">
			<media:title type="html">bash case statement conditiona</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Escaping_meta.gif" medium="image">
			<media:title type="html">escaping meta characters in bash</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash_single_quotes.gif" medium="image">
			<media:title type="html">Using single quotes in bash</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash_double_quotes.gif" medium="image">
			<media:title type="html">Using double quotes in bash</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Ansi-c_bash.gif" medium="image">
			<media:title type="html">quoting in bash with ansi-c stype</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash_addition_calc.gif" medium="image">
			<media:title type="html">Bash Addition Calculator</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/bash-arithmetic_operations.gif" medium="image">
			<media:title type="html">Bash Arithmetic Operations</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash_round_floating_point_number.gif" medium="image">
			<media:title type="html">Round floating point number with bash</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/Bash_floating_point.gif" medium="image">
			<media:title type="html">Bash floating point calculations</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/STDOUTtoSTDERR.gif" medium="image">
			<media:title type="html">STDOUT from bash script to STDERR</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/images/STDERRtoSTDOUT.gif" medium="image">
			<media:title type="html">STDERR from bash script to STDOUT</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/delicious.png" medium="image">
			<media:title type="html">Submit Bash scripting Tutorial in Delicious</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/digg.png" medium="image">
			<media:title type="html">Submit Bash scripting Tutorial in Digg</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/facebook.png" medium="image">
			<media:title type="html">Submit Bash scripting Tutorial in FaceBook</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/google.png" medium="image">
			<media:title type="html">Submit Bash scripting Tutorial in Google Bookmarks</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/stumbleupon.png" medium="image">
			<media:title type="html">Submit Bash scripting Tutorial in Stumbleupon</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/technorati.png" medium="image">
			<media:title type="html">Submit Bash scripting Tutorial in Technorati</media:title>
		</media:content>

		<media:content url="http://linuxconfig.org/plugins/content/itpsocialbuttons/images/balloon/twitter.png" medium="image">
			<media:title type="html">Submit Bash scripting Tutorial in Twitter</media:title>
		</media:content>
	</item>
	</channel>
</rss>
