Hi All,
I have written script and wanted to know the run time of it in seconds. i used below logic but am not getting the results in second instead getting error.
cat pkloader.sh
# if you want to calculate the time in milliseconds then use $(date +%s%N)
START_TIME=`date +%s`
echo "$START_TIME"
##### logic #######
echo "pkloader execution has completed"
END_TIME=`date +%s`
echo "$END_TIME"
DIFF=$(( $END_TIME - $START_TIME ))
echo "Script took $DIFF seconds to complete"
Error am getting when running the script :
./pkloader.sh: line 33: %s - %s : syntax error: operand expected (error token is "%s - %s ")
and observed that on line to print START_TIME and END_TIME , i get just %s as output.
this script running in SunOS