![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Run script at same time | Jamil Qadir | Shell Programming and Scripting | 3 | 03-07-2008 12:00 PM |
| run script in autosys at a specified time. | gram77 | UNIX for Advanced & Expert Users | 1 | 03-06-2008 02:24 PM |
| Preventing script to run at the same time. | cronboss | UNIX for Advanced & Expert Users | 3 | 11-26-2007 10:48 AM |
| First time help, please - checksum script... | kapolani | Shell Programming and Scripting | 6 | 10-06-2004 09:22 AM |
| Please Help ( Calculate time taken in a script) | sanjay92 | UNIX for Dummies Questions & Answers | 9 | 10-02-2001 11:20 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
time take by a script
Hi !
I have got a script which takes some time to execute. Eg. if the script is called test.sh #!/bin/bash <command1 to execute> <command2 to execute> <command3 to execute> <command4 to execute> . . . . <command n to execute> At the end of the script I want to show the users the actual time(user NOT CPU) taken for the script to execute. I know of the time command but where shall I put in the code for calculating the time. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Hi..
A solution would be to use test.sh to time another shell script with the acctual commands.. --- test.sh #!/bin/sh time /path/to/script/sh --- /Peter |
|
#3
|
||||
|
||||
|
Code:
#!/bin/ksh
time ( command1 && \
command2 && \
command3 && \
commandn )
exit 0
Peter's solution above is guaranteed to work on all shells so is the solution I'd personally go for. Ta, ZB |
|
#4
|
||||
|
||||
|
Thanks Peter!
I was expecting a similar solution. Cheers |
||||
| Google The UNIX and Linux Forums |