Results 1 to 3 of 3
Hi,
What is a command in bash script to get time same like time in perl? Time in seconds. I just want to calculate how long will it take to ...
- 10-02-2008 #1Just Joined!
- Join Date
- Sep 2008
- Location
- Tacoma, Washington
- Posts
- 8
time in bash
Hi,
What is a command in bash script to get time same like time in perl? Time in seconds. I just want to calculate how long will it take to run my process. Thanks.
-nodopro
- 10-03-2008 #2Linux User
- Join Date
- Jun 2007
- Posts
- 318
Would the %s option in date command work:
%s seconds since 00:00:00 1970-01-01 UTC (a GNU extension)
Code:#!/bin/bash STRT=`date "+%s"` sleep 10 END=`date "+%s"` DIFF=$(($END-$STRT)) echo "Ran $DIFF seconds"
- 10-03-2008 #3Just Joined!
- Join Date
- Sep 2008
- Location
- Tacoma, Washington
- Posts
- 8
Great. Thanks vsemaska.
-nodopro


Reply With Quote