Monday, November 2, 2009

shell programming

for:
for (( i = 0; i < 10; i++ )) #pay attention to the spaces!!!
do
echo ${i}
done

if:
a=3
if [ $a -lt 2 ] ; # the ;
then
echo $a;
fi


add:
a=3
b=4
c=$(( a + b )) #with $(( )), no $ is needed
echo $c

Some other possibilities to do addition: let key word!
let count=count+1

let "count+=1"

let "count++"

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.