Код: Выделить всё
#!/bin/sh -xv
if [ `uname` = "Linux" ]
then
params=--date="1 hour ago"
else
params="-v-1H"
fi
uname
++ uname
+ '[' Linux = Linux ']'
+ params='--date=1 hour ago'
if [ `date $params +%Y%m%d%H%M%S` -ge 12345 ]
then
echo OK
fi
date $params +%Y%m%d%H%M%S
++ date --date=1 hour ago +%Y%m%d%H%M%S
date: extra operand `ago'
Try `date --help' for more information.
+ '[' -ge 12345 ']'
/tmp/a.sh: line 13: [: -ge: unary operator expected
root@hosting:~#