LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-10-2013, 02:58 AM   #1
rakrr786
Member
 
Registered: May 2012
Posts: 34

Rep: Reputation: Disabled
how to get the total timeto ccomplete script execution


hi

i want to know if there is a command by which i can see how much time it takes for a complete execution of script of program.

also is there any way for line by line debugging of shell script i.e. to execute one line at a time.
 
Old 05-10-2013, 03:43 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,905

Rep: Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921
there is a command time to do that:
time <your command>
(see man page of bash)
 
1 members found this post helpful.
Old 05-10-2013, 03:46 AM   #3
rakrr786
Member
 
Registered: May 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
is there a way to debug a single line at a time i know the -xv way
 
Old 05-10-2013, 03:54 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,417

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
Just set/unset xv per line eg
Code:
set -xv; a=(a "b 2" c); set +xv
Incidentally, there's 2 ways to time a script
Code:
# just time
time ./t2.sh
a
b 2
c

real	0m0.003s
user	0m0.001s
sys	0m0.003s

# time & mem & cpu & ....
\time ./t2.sh
a
b 2
c

0.00user 0.00system 0:00.00elapsed 50%CPU (0avgtext+0avgdata 4800maxresident)k
0inputs+0outputs (0major+339minor)pagefaults 0swaps

Last edited by chrism01; 05-10-2013 at 03:56 AM.
 
1 members found this post helpful.
Old 05-10-2013, 03:56 AM   #5
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,905

Rep: Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921Reputation: 2921
http://www.cyberciti.biz/tips/debugg...ll-script.html
I found this, but quite old: http://archive09.linux.com/feature/153383 or http://bashdb.sourceforge.net/bashdb.html
 
1 members found this post helpful.
Old 05-10-2013, 03:59 AM   #6
rakrr786
Member
 
Registered: May 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
thanks chris and pan
 
  


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
pls give suggestion for waiting the parent upto completing total execution in child nagendrar Programming 1 07-08-2009 03:16 AM
script execution yakoub Linux - Software 3 11-12-2006 02:26 AM
Script execution salmanucit Linux - Software 1 12-08-2005 09:51 AM
script execution on halt linuxhippy Slackware 4 04-01-2005 08:09 PM
script execution Johng Programming 2 08-21-2004 05:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:45 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration