LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to get the total timeto ccomplete script execution (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-get-the-total-timeto-ccomplete-script-execution-4175461390/)

rakrr786 05-10-2013 01:58 AM

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.

pan64 05-10-2013 02:43 AM

there is a command time to do that:
time <your command>
(see man page of bash)

rakrr786 05-10-2013 02:46 AM

is there a way to debug a single line at a time i know the -xv way

chrism01 05-10-2013 02:54 AM

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


pan64 05-10-2013 02:56 AM

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

rakrr786 05-10-2013 02:59 AM

thanks chris and pan


All times are GMT -5. The time now is 04:57 AM.