let command not working

October 7, 2010 at 04:19:20
Specs: Linux x86_64
I'm trying to use the let command to find the difference in time - the code works in Linux/Unix but it isn't working in Solaris what is wrong?

Basic part is:

tstart=`date +%s`
echo $tstart
tend=`date +%s`
echo $tend
let tout=$tend-$tstart
echo $tout

In solaris I get this error message: let: tout=%s-%s: syntax error: operand expected (error token is "%s-%s")

See More: let command not working

Report •

October 7, 2010 at 07:42:50
There is nothing wrong with the let command or your script. The problem is that the Solaris date command does not support the 'seconds since the epoch' option %s.

The %s option is an extension of the GNU date command. You can probably get the GNU date for solaris at http://www.gnu.org.

Report •
Related Solutions

Ask Question