<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Help Needed For &amp;quot;time&amp;quot; command in HP-UX and Linux in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941732#M66252</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I need to use 'time &lt;COMMAND&gt;' command to calculate the "real" time elapsed during execution of the &lt;COMMAND&gt;, from shell and redirect the output in a file or may be in a variable. &lt;BR /&gt;&lt;BR /&gt;man page of 'time' in HP-UX says that the times (real,user and sys) will be printed in stderr. &lt;BR /&gt;linux (RHEL) man page of time says that the times (real,user and sys) will be printed in stdout.&lt;BR /&gt;&lt;BR /&gt;But any amount of redirection attempt like below are failing: - &lt;BR /&gt;&lt;BR /&gt;time sleep 1 2&amp;gt;/tmp/xxx&lt;BR /&gt;time sleep 1 &amp;gt;/tmp/xx&lt;BR /&gt;time sleep 1 |tee /tmp/xxx&lt;BR /&gt;time sleep 1|grep real &amp;gt;/tmp/xxx&lt;BR /&gt;TIME_ELAPSED=`time sleep 1`; echo $TIME_ELAPSED&lt;BR /&gt;&lt;BR /&gt;etc...in both HP-UX and RHEL. &lt;BR /&gt;&lt;BR /&gt;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. &lt;BR /&gt;&lt;BR /&gt;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. &lt;BR /&gt;&lt;BR /&gt;Thanking you in advance. &lt;BR /&gt;&lt;BR /&gt;Sujoy Sarkar&lt;BR /&gt;Hewlett-Packard Co.&lt;BR /&gt;Bangalore - India&lt;BR /&gt;Ph: +91 80 2205 3084&lt;BR /&gt;&lt;/COMMAND&gt;&lt;/COMMAND&gt;</description>
    <pubDate>Fri, 18 Nov 2005 08:54:53 GMT</pubDate>
    <dc:creator>Sujoy</dc:creator>
    <dc:date>2005-11-18T08:54:53Z</dc:date>
    <item>
      <title>Help Needed For "time" command in HP-UX and Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941732#M66252</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I need to use 'time &lt;COMMAND&gt;' command to calculate the "real" time elapsed during execution of the &lt;COMMAND&gt;, from shell and redirect the output in a file or may be in a variable. &lt;BR /&gt;&lt;BR /&gt;man page of 'time' in HP-UX says that the times (real,user and sys) will be printed in stderr. &lt;BR /&gt;linux (RHEL) man page of time says that the times (real,user and sys) will be printed in stdout.&lt;BR /&gt;&lt;BR /&gt;But any amount of redirection attempt like below are failing: - &lt;BR /&gt;&lt;BR /&gt;time sleep 1 2&amp;gt;/tmp/xxx&lt;BR /&gt;time sleep 1 &amp;gt;/tmp/xx&lt;BR /&gt;time sleep 1 |tee /tmp/xxx&lt;BR /&gt;time sleep 1|grep real &amp;gt;/tmp/xxx&lt;BR /&gt;TIME_ELAPSED=`time sleep 1`; echo $TIME_ELAPSED&lt;BR /&gt;&lt;BR /&gt;etc...in both HP-UX and RHEL. &lt;BR /&gt;&lt;BR /&gt;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. &lt;BR /&gt;&lt;BR /&gt;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. &lt;BR /&gt;&lt;BR /&gt;Thanking you in advance. &lt;BR /&gt;&lt;BR /&gt;Sujoy Sarkar&lt;BR /&gt;Hewlett-Packard Co.&lt;BR /&gt;Bangalore - India&lt;BR /&gt;Ph: +91 80 2205 3084&lt;BR /&gt;&lt;/COMMAND&gt;&lt;/COMMAND&gt;</description>
      <pubDate>Fri, 18 Nov 2005 08:54:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941732#M66252</guid>
      <dc:creator>Sujoy</dc:creator>
      <dc:date>2005-11-18T08:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Help Needed For "time" command in HP-UX and Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941733#M66253</link>
      <description>good utils for this kind of work.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.ws/merijn/caljd-2.23.sh" target="_blank"&gt;http://hpux.ws/merijn/caljd-2.23.sh&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.ws/merijn/caljd-2.2.pl" target="_blank"&gt;http://hpux.ws/merijn/caljd-2.2.pl&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Fri, 18 Nov 2005 08:59:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941733#M66253</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2005-11-18T08:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help Needed For "time" command in HP-UX and Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941734#M66254</link>
      <description>If you change to ksh shell, you can use the time --output option.&lt;BR /&gt;&lt;BR /&gt;#!/bin/ksh&lt;BR /&gt;time --output time.out ls&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Nov 2005 09:35:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941734#M66254</guid>
      <dc:creator>Ivan Ferreira</dc:creator>
      <dc:date>2005-11-18T09:35:59Z</dc:date>
    </item>
    <item>
      <title>Re: Help Needed For "time" command in HP-UX and Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941735#M66255</link>
      <description>The trick is that the time command is actually a shell builtin for some shells.  You can use quoting as 'time' or use a full path as /usr/bin/time to get the actual command described by "man time".  You can also use parentheses to run the time builtin in a subshell to redirect its output.&lt;BR /&gt;&lt;BR /&gt;'time' sleep 1 2&amp;gt; /tmp/xx&lt;BR /&gt;&lt;BR /&gt;/usr/bin/time sleep 1 2&amp;gt; /tmp/xx&lt;BR /&gt;&lt;BR /&gt;(time sleep 1) 2&amp;gt; /tmp/xx&lt;BR /&gt;</description>
      <pubDate>Fri, 18 Nov 2005 10:50:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941735#M66255</guid>
      <dc:creator>Mike Stroyan</dc:creator>
      <dc:date>2005-11-18T10:50:46Z</dc:date>
    </item>
    <item>
      <title>Re: Help Needed For "time" command in HP-UX and Linux</title>
      <link>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941736#M66256</link>
      <description>Sorry for response too late. &lt;BR /&gt;The solutions really helped me get going.&lt;BR /&gt;Thanks.&lt;BR /&gt;\Sujoy&lt;BR /&gt;Hewlett-Packard Co.</description>
      <pubDate>Thu, 08 Jun 2006 06:19:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/help-needed-for-quot-time-quot-command-in-hp-ux-and-linux/m-p/4941736#M66256</guid>
      <dc:creator>Sujoy</dc:creator>
      <dc:date>2006-06-08T06:19:00Z</dc:date>
    </item>
  </channel>
</rss>

