请教shell脚本把时间转换成秒
请教一个shell脚本。$length="00:01:26.99"
#上面的是个时间长度,如何转成
86.99或者取整到87单位是秒。 [b]回复 [url=http://www.bathome.net/redirect.php?goto=findpost&pid=226714&ptid=54904]1#[/url] [i]netdzb[/i] [/b][code]#!/bin/bash
length="00:01:26.99";
var=$[${length:0:2}*3600+${length:3:2}*60+${length:6:2}+1];
echo $var[/code] [b]回复 [url=http://www.bathome.net/redirect.php?goto=findpost&pid=226716&ptid=54904]2#[/url] [i]red2020[/i] [/b]
可以了,谢谢。
页:
[1]