LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-04-2009, 02:10 AM   #1
Himilhil
Member
 
Registered: Jun 2009
Posts: 52

Rep: Reputation: 15
Getting duration of execution in bash


I need to get duration of execution of command or few semi separated commands. I tried to use "time" command. But it didn't give me elapsed time for few semi separated commands, only duration of first command. How can i get it?
 
Old 11-04-2009, 02:14 AM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,329

Rep: Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745
Please give an example of what you are trying and what you want/expect.
 
Old 11-04-2009, 02:38 AM   #3
Himilhil
Member
 
Registered: Jun 2009
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by chrism01 View Post
Please give an example of what you are trying and what you want/expect.
I tried to do this: time sleep 10; sleep 10.

I got this:
real 0m10.005s
user 0m0.000s
sys 0m0.004s

And i want to get something like this:
real 0m20.005s
user 0m0.000s
sys 0m0.004s
 
Old 11-04-2009, 03:05 AM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,720

Rep: Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704Reputation: 1704
Quote:
Originally Posted by Himilhil View Post
I tried to do this: time sleep 10; sleep 10.

I got this:
real 0m10.005s
user 0m0.000s
sys 0m0.004s

And i want to get something like this:
real 0m20.005s
user 0m0.000s
sys 0m0.004s
time (sleep 10 ; sleep 10)

HTH,

Evo2.
 
Old 11-04-2009, 03:21 AM   #5
Himilhil
Member
 
Registered: Jun 2009
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by evo2 View Post
time (sleep 10 ; sleep 10)
Ok. That's what i want. Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Detect bash script source vs. direct execution Jessard Programming 11 11-30-2010 07:43 AM
bash calculate job duration Padawan.AVT Programming 2 10-07-2008 03:33 AM
Duration of backscatter billymayday Linux - Security 9 01-20-2007 06:47 AM
BASH: open console on script execution Quis Programming 2 02-07-2006 10:41 AM
Execution options in bash eremit Programming 6 03-28-2005 11:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration