LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 01: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, 02:43 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
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, 02: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, 02:54 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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 02:56 AM.
 
1 members found this post helpful.
Old 05-10-2013, 02:56 AM   #5
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
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, 02:59 AM   #6
rakrr786
Member
 
Registered: May 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
thanks chris and pan
 
  


Reply



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 02:16 AM
script execution yakoub Linux - Software 3 11-12-2006 01:26 AM
Script execution salmanucit Linux - Software 1 12-08-2005 08:51 AM
script execution on halt linuxhippy Slackware 4 04-01-2005 07:09 PM
script execution Johng Programming 2 08-21-2004 04:58 PM

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

All times are GMT -5. The time now is 05: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
Open Source Consulting | Domain Registration