- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Help Needed For "time" command in HP-UX and Linux
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:54 AM
тАО11-18-2005 12:54 AM
Help Needed For "time" command in HP-UX and Linux
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 12:59 AM
тАО11-18-2005 12:59 AM
Re: Help Needed For "time" command in HP-UX and Linux
http://hpux.ws/merijn/caljd-2.23.sh
http://hpux.ws/merijn/caljd-2.2.pl
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 01:35 AM
тАО11-18-2005 01:35 AM
Re: Help Needed For "time" command in HP-UX and Linux
#!/bin/ksh
time --output time.out ls
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2005 02:50 AM
тАО11-18-2005 02:50 AM
Re: Help Needed For "time" command in HP-UX and Linux
'time' sleep 1 2> /tmp/xx
/usr/bin/time sleep 1 2> /tmp/xx
(time sleep 1) 2> /tmp/xx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2006 11:19 PM
тАО06-07-2006 11:19 PM
Re: Help Needed For "time" command in HP-UX and Linux
The solutions really helped me get going.
Thanks.
\Sujoy
Hewlett-Packard Co.