Thursday, January 24, 2008

Unix sh script basic

If you use if, must retain space between "[" and the latter word.

chmod 750
./scriptname


#!/bin/sh

use BACK QUOTE ` to quote a comand you want it to run, not SINGLE Quote '


#!/bin/sh
TIME=`date +%H`
#echo -e | $TIME
echo $TIME
if [ $TIME = 10 ]
then


echo "it is 10"

else

echo "not 10"
fi

0 Comments:

Post a Comment

<< Home