I am on SunOS machine trying to get the date string of the past minute, yesterday I used this command I found on the internetexpr `date +%Y%m%d%k%M` - 1which is worked just fine and I saw the output and this is the output I got from my session that is still opened:bash-3.00$ expr `date +%Y%m%d%k%M` - 1201303131641Now I am trying to run this command on the same session and I got this output:bash-3.00$ expr `date +%Y%m%d%k%M` - 1expr: syntax errorMy machine is running this OS:bash-3.00$ uname -aSunOS mySunOS 5.10 Generic_144488-11 sun4v sparc SUNW,Netra-T2000I think there is some environmental variable or something that have been changed, can anyone help me out with this?
expr command used to work and stopped
bash;date;math;solaris
Try %H instead of %k. Yesterday it probably worked because the hour had double digits then. Note that this is not a good way to get the previous minute, because of what happens when the time is exactly on the hour.