#!/bin/bash
#var=1h33
#var=33
var=
var2=`echo ${var} |wc -L`
if [ "0" = ${var2} ];then
echo 60
exit 0
fi
h=`echo ${var%%h*}`
m=`echo ${var##*h}`
h2=`expr match $var '.*\([a-z]\)'`
hh=60*60
mm=60
if [ ${h2} ];then
time1=$(($h*$hh+$m*$mm))
echo $time1
else
time1=$(($m*$mm))
echo $time1
fi
注:var为时间输入变量