![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Average completion time calculation? | Seawall | UNIX for Dummies Questions & Answers | 5 | 05-20-2008 07:13 AM |
| specifying an execution time | VGR | UNIX for Advanced & Expert Users | 7 | 03-19-2008 05:32 AM |
| change time interval for /proc/loadavg calculation | Rakesh Ranjan | High Level Programming | 2 | 05-12-2006 05:48 AM |
| last execution time | cubs0729 | UNIX for Dummies Questions & Answers | 1 | 01-20-2006 08:45 PM |
| time calculation | liux99 | UNIX for Advanced & Expert Users | 2 | 08-18-2005 11:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
script execution time calculation
I am writting a script in the ksh shell and am trying to find a way to report the total execution time of the script without requiring the user to specify the time function when executing the script.
Does anyone have any examples they have used. I have been setting up two date variables (one at the beginning $START_TIME and one at the end $END_TIME) and then do some calulation of the difference and display is to the user in minutes. No matter what I do it keeps giving me syntax errors. any help |
|
|||||
|
Quote:
Hmm... I should modify the script ! |
|
||||
|
hi
Quote:
hye dude the syntax for setting start_date is not working... i am workin in bash... i too tried out printing the time taken by a process |
|
|||||
|
Quote:
Possibly you dont have GNU date. Post the results of Code:
strings `which date` | grep '%s' Last edited by vino; 02-24-2006 at 04:29 AM.. |
|
||||
|
$ strings `which date` | grep '%s'
$ Returns nothing $ which date /usr/bin/date $ Here is the code I have been testing with: #!/bin/ksh start=$(date +%s) time sleep 20 end=$(date +%s) echo "Time: $((end - start)) secs." Results: syntax error changed to: #!/bin/ksh start=$SECONDS time sleep 20 end=$SECONDS echo "Time: $((end - start)) secs." Results: This works! My question now is, will it still work after hours of execution. How ofter does this value get reset? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|