Crontab influences bash script if condition?

I am a bit baffled here, and not really sure how to debug this. I have a self-written bash script, that checks if a samba share is active, and if not, sends me an email.

Script is in /root/SKRIPTS/, permission looks like this:

-rwxr-xr-x   1 root  wheel   281 Nov  8 08:54 -rwx------   1 root  wheel    39 Nov  7 13:56 smbclient.cred 

Content of the .sh script is this:

smbclient -L -A /root/SKRIPTS/smbclient.cred | grep -q Backup  if [ $  ? -eq 0 ] then     echo "Backup_* mounted, nothing to do" else     echo "Subject: Samba has failed" | /usr/sbin/sendmail -v mail@localmail.server fi  return 1; 

/etc/crontab looks like this (entry only)

10 1 * * * root /root/SKRIPTS/ 

The thing is, if I, as root, run this, it works flawlessly. But every night I get an email that samba has failed, indicating that the cron script somehow trips into the else path. How can this be? Am I missing something obvious here? What would be the best way to debug this?

Thanks for your help