<?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 Re: Script, strange results in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914895#M108150</link>
    <description>Hi Rogelio,&lt;BR /&gt;&lt;BR /&gt;There is a problem with using a shell variable withing single quotes. enclosing in single quotes offers a performance benefit so that the shell does not pre-evaluate the strings as the shell interpreter should normally.&lt;BR /&gt;&lt;BR /&gt;You may use however the eval command to ensure that the variables get pre-evaluated, in this manner.&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh &lt;BR /&gt;for TIMESTAMP in $(cat /ser/tmp/timestamps.lst); do &lt;BR /&gt;DATE=$(eval "perl -e 'print scalar localtime($TIMESTAMP)'") &lt;BR /&gt;echo "The timestamp $TIMESTAMP is: $DATE" &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;BR /&gt;Just another way....&lt;BR /&gt;&lt;BR /&gt;ramd.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 28 Feb 2003 07:59:44 GMT</pubDate>
    <dc:creator>Ramkumar Devanathan</dc:creator>
    <dc:date>2003-02-28T07:59:44Z</dc:date>
    <item>
      <title>Script, strange results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914888#M108143</link>
      <description>I???m trying to convert a list of timestamp values in a file, to a readable and normal date.&lt;BR /&gt;I???m using this script:&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh&lt;BR /&gt;for TIMESTAMP in $(cat /ser/tmp/timestamps.lst); do&lt;BR /&gt; DATE=$(perl -e 'print scalar localtime($TIMESTAMP)')&lt;BR /&gt; echo "The timestamp $TIMESTAMP is: $DATE"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This is the output:&lt;BR /&gt;&lt;BR /&gt;The timestamp 1046289600 is: Wed Dec 31 18:00:00 1969&lt;BR /&gt;The timestamp 1046289300 is: Wed Dec 31 18:00:00 1969&lt;BR /&gt;The timestamp 1046289000 is: Wed Dec 31 18:00:00 1969&lt;BR /&gt;The timestamp 1046288700 is: Wed Dec 31 18:00:00 1969&lt;BR /&gt;The timestamp 1046288400 is: Wed Dec 31 18:00:00 1969&lt;BR /&gt;The timestamp 1046288100 is: Wed Dec 31 18:00:00 1969&lt;BR /&gt;&lt;BR /&gt;And so on??? the output is always the same??? but if I run the command manually from the shell, I get the correct value.&lt;BR /&gt;&lt;BR /&gt;Any idea about this behavior?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance for any hint!&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;&lt;BR /&gt;Rogelio&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Feb 2003 15:14:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914888#M108143</guid>
      <dc:creator>Rogelio Quintanilla</dc:creator>
      <dc:date>2003-02-27T15:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script, strange results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914889#M108144</link>
      <description>Have you tried fully qualifying your path to perl in the script?</description>
      <pubDate>Thu, 27 Feb 2003 15:16:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914889#M108144</guid>
      <dc:creator>Patrick Wallek</dc:creator>
      <dc:date>2003-02-27T15:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Script, strange results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914890#M108145</link>
      <description>Try exporting TIMESTAMP var.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh &lt;BR /&gt;TIMESTAMP=" "&lt;BR /&gt;export TIMESTAMP&lt;BR /&gt;for TIMESTAMP in $(cat /ser/tmp/timestamps.lst); do &lt;BR /&gt;DATE=$(perl -e 'print scalar localtime($TIMESTAMP)') &lt;BR /&gt;echo "The timestamp $TIMESTAMP is: $DATE" &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Feb 2003 15:18:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914890#M108145</guid>
      <dc:creator>Carlos Fernandez Riera</dc:creator>
      <dc:date>2003-02-27T15:18:38Z</dc:date>
    </item>
    <item>
      <title>Re: Script, strange results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914891#M108146</link>
      <description>Hi Rogelio,&lt;BR /&gt;&lt;BR /&gt;You need double-quotes in your perl statement, otherwise the $TIMESTAMP variable is not evaluated.&lt;BR /&gt;&lt;BR /&gt;rgds, Robin</description>
      <pubDate>Thu, 27 Feb 2003 15:27:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914891#M108146</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2003-02-27T15:27:07Z</dc:date>
    </item>
    <item>
      <title>Re: Script, strange results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914892#M108147</link>
      <description>Thank's Patrick and Carlos.&lt;BR /&gt;&lt;BR /&gt;I tried both options, but the results are the same.&lt;BR /&gt;&lt;BR /&gt;DATE=" "&lt;BR /&gt;export DATE&lt;BR /&gt;TIMESTAMP=" "&lt;BR /&gt;export TIMESTAMP&lt;BR /&gt;for TIMESTAMP in $(cat /ser/tmp/timestamps.lst); do&lt;BR /&gt; DATE=$(/usr/local/bin/perl -e 'print scalar localtime($TIMESTAMP)')&lt;BR /&gt; echo "The timestamp $TIMESTAMP is: $DATE"&lt;BR /&gt;done&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Feb 2003 15:27:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914892#M108147</guid>
      <dc:creator>Rogelio Quintanilla</dc:creator>
      <dc:date>2003-02-27T15:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script, strange results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914893#M108148</link>
      <description>Thank you very much Robin, it works perfectly now!&lt;BR /&gt;&lt;BR /&gt;Best regards&lt;BR /&gt;&lt;BR /&gt;Rogelio</description>
      <pubDate>Thu, 27 Feb 2003 15:31:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914893#M108148</guid>
      <dc:creator>Rogelio Quintanilla</dc:creator>
      <dc:date>2003-02-27T15:31:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script, strange results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914894#M108149</link>
      <description>T yhink Robin is right.&lt;BR /&gt;&lt;BR /&gt;You must use double quotes instead of single quotes:&lt;BR /&gt;&lt;BR /&gt; DATE=$(perl -e "print scalar localtime($TIMESTAMP)")&lt;BR /&gt;&lt;BR /&gt;I think localtime() parameter is an unsigned integer. Using double quotes the parameter value for localtime() is the string '$TIMESTAMP' ( i.e, dolar capital T, capital I...) not the value of TIMESTAMP variable.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Feb 2003 15:33:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914894#M108149</guid>
      <dc:creator>Jdamian</dc:creator>
      <dc:date>2003-02-27T15:33:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script, strange results</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914895#M108150</link>
      <description>Hi Rogelio,&lt;BR /&gt;&lt;BR /&gt;There is a problem with using a shell variable withing single quotes. enclosing in single quotes offers a performance benefit so that the shell does not pre-evaluate the strings as the shell interpreter should normally.&lt;BR /&gt;&lt;BR /&gt;You may use however the eval command to ensure that the variables get pre-evaluated, in this manner.&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;&lt;BR /&gt;#!/bin/sh &lt;BR /&gt;for TIMESTAMP in $(cat /ser/tmp/timestamps.lst); do &lt;BR /&gt;DATE=$(eval "perl -e 'print scalar localtime($TIMESTAMP)'") &lt;BR /&gt;echo "The timestamp $TIMESTAMP is: $DATE" &lt;BR /&gt;done &lt;BR /&gt;&lt;BR /&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;BR /&gt;Just another way....&lt;BR /&gt;&lt;BR /&gt;ramd.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Feb 2003 07:59:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-strange-results/m-p/2914895#M108150</guid>
      <dc:creator>Ramkumar Devanathan</dc:creator>
      <dc:date>2003-02-28T07:59:44Z</dc:date>
    </item>
  </channel>
</rss>

