- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: Help Needed For "time" command in HP-UX and Li...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 12:52 AM
тАО11-18-2005 12:52 AM
I need to use 'time
man page of 'time' in HP-UX says that the times (real,user and sys) will be printed in stderr.
linux (RHEL) man page of time says that the times (real,user and sys) will be printed in stdout.
But any amount of redirection attempt like below are failing: -
time sleep 1 2>/tmp/xxx
time sleep 1 >/tmp/xx
time sleep 1 |tee /tmp/xxx
time sleep 1|grep real >/tmp/xxx
TIME_ELAPSED=`time sleep 1`; echo $TIME_ELAPSED
etc...in both HP-UX and RHEL.
I also tried to use 'timex' as workaround which does not show this redirection problem. But 'timex' is not available in Linux, hence i need to fall back on 'time' only which works for both HP-UX and Linux.
It shall be extremely helpful if you can tell me how to capture the output of 'time' command from shell into file or a shell variable. Also, if any other command can complement my requirement of calculating the elapsed time of an executed command that would also be very helpful.
Thanking you in advance.
Sujoy Sarkar
Hewlett-Packard Co.
Bangalore - India
Ph: +91 80 2205 3084
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 01:03 AM
тАО11-18-2005 01:03 AM
Re: Help Needed For "time" command in HP-UX and Linux
Interesting, an old 10.20 'time' works. On 11.11 I obtain your result. I think "broken" is the word.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 01:08 AM
тАО11-18-2005 01:08 AM
Re: Help Needed For "time" command in HP-UX and Linux
No, I think I'm crazy. This works just fine on 11.11 :
# time sleep 1 2>/tmp/xxx
I was typing "times" instead. :-((
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 01:12 AM
тАО11-18-2005 01:12 AM
Re: Help Needed For "time" command in HP-UX and Linux
does not get the output into /tmp/xxx
in "HP-UX ccux1 B.11.11 U 9000/800 1861980610 unlimited-user license"
also in "HP-UX ccux3 B.11.23 U ia64 0943546897 unlimited-user license"
It only throws the output in screen.
--Sujoy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 01:16 AM
тАО11-18-2005 01:16 AM
Re: Help Needed For "time" command in HP-UX and Linux
# time sleep 1 2>/tmp/xxx
# /tmp/xxx
real 1.0
user 0.0
sys 0.0
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 01:40 AM
тАО11-18-2005 01:40 AM
Re: Help Needed For "time" command in HP-UX and Linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 01:45 AM
тАО11-18-2005 01:45 AM
Re: Help Needed For "time" command in HP-UX and Linux
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 02:35 AM
тАО11-18-2005 02:35 AM
Solution$ time sleep 1
real 0m1.004s
user 0m0.001s
sys 0m0.001s
$ 'time' sleep 1
0.00user 0.00system 0:01.00elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+200minor)pagefaults 0swaps
$ /usr/bin/time sleep 1
0.00user 0.00system 0:01.00elapsed 0%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+199minor)pagefaults 0swaps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 11:20 PM
тАО06-07-2006 11:20 PM