Sunday, April 4, 2010

Shell Scripting

if constuct
The if condition can test various conditions.

Usage of if to test successful execution of commands:
if cp src dst
then
echo "cp succeeded"
fi

Usage of test directive with if:
if test a -lt b
then
echo "a < b"
fi

Usage of if with [ ]
if [ a -lt b ]
then
echo "a < b"
fi

No comments:

Post a Comment