>Bash script basics

By | November 8, 2010

>I am starting a bash script basics post series. This series will help script kiddies to write smart scripts. Here i am not going to discuss bash scripting in detail, but share some logics and syntaxes that enhance understanding of scripts.
Today i am discussing here about null command [:] , This is do-nothing operation. its a shell builtin, and its exit status is true.
For example , if you write following
root# :
root#echo $?
It will print 0 ($? will print exit status which is true(0))
We can use this concept to execute endless loop

while :
do
…..
done

This logic can also be implemented where we need a placeholder. For example
if condition ; then
:
else
…(some code)
fi

Share itShare on FacebookEmail this to someoneTweet about this on TwitterShare on Google+Share on LinkedInPrint this page

One thought on “>Bash script basics

Leave a Reply

Your email address will not be published. Required fields are marked *

Current month ye@r day *