Sleep Command

I am in need of some help; think I have confused myself.

Here is the issue I am faced with.

The script log file was fine, the nohup.out file has tens of thousands of lines like illegal use of sleep: sleep seconds

So I assume there is something with the seconds calculation in the script belwo; also checked date function on unix, didn't find anything wrong.

let target_hour=0730

if ( $# <= 2 ) then
 echo Usage: schedule1 [shell file] "&"
 exit 1
else
 
k=1
while :
do 

   current_date=`date +%w` 
   current_hour=`date +%H%M`
   second=`date +%S`
   var1=`date +%H`
   var1_min=`date +%M`
   var2=${target_hour%??}
   var2_min=${target_hour#??}

   if [[ current_date -gt -1 ]]
   then
		if [[ current_hour -lt target_hour ]] 
		then
		   hours=$((((var2-var1))*3600))
		   minutes=$((((var2_min - var1_min))*60))
		   if [[ var2 -gt var1 ]]
		   then
		      sleep $((hours+minutes-second))
		   elif [[ var2 -eq var1 ]]
		   then
			  sleep $((minutes-second))
		   fi
		   k=1
		elif [[ current_hour -gt target_hour ]]
		then 
			hours=$((((23-var1))*3600))
			minutes=$((((60-var1_min))*60))
			sleep $((hours+minutes-second))
			k=0
		elif [[ current_hour -eq target_hour ]]  &&  [[ k -eq 1 ]] 
		then
			echo `date +%Y%m%d`
			$1
			k=0
		elif [[ current_hour -eq 1000 ]]  &&  [[ k -eq 0 ]] 
		then
			hours=$((((23-var1))*3600))
			minutes=$((((60-var1_min))*60))
			sleep $((hours+minutes-second))
			k=0
	  	fi    
	else
		hours=$((((23-var1))*3600))
		minutes=$((((60-var1_min))*60))
		sleep $((hours+minutes-second))
		k=1
	fi
done
fi

If you can help me that would be great.

Thanks,

Glove

check if $((hours+minutes-second)) results in a numeric value in the shell that you are using