<?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: Date Calculation Failed in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004418#M64162</link>
    <description>Hi (again) David:&lt;BR /&gt;&lt;BR /&gt;Well, you now have learned that a shell comes in many flavors and a script written for one insn't necessary portable to under without some work.&lt;BR /&gt;&lt;BR /&gt;As Clay noted, use his Perl version.  That will work without any effort on your part!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Mon, 21 May 2007 16:36:57 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2007-05-21T16:36:57Z</dc:date>
    <item>
      <title>Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004412#M64156</link>
      <description>Hi gurus,&lt;BR /&gt;&lt;BR /&gt;I have used caljd.sh many times with no problems but today when I tried to use it, it produced this error.&lt;BR /&gt;&lt;BR /&gt; $ caljd.sh -S "-" -o -e 2454250&lt;BR /&gt;./caljd.sh: line 129: typeset: -Z: invalid option&lt;BR /&gt;typeset: usage: typeset [-afFirtx] [-p] name[=value] ...&lt;BR /&gt;./caljd.sh: line 131: typeset: -Z: invalid option&lt;BR /&gt;typeset: usage: typeset [-afFirtx] [-p] name[=value] ...&lt;BR /&gt;./caljd.sh: line 137: typeset: -Z: invalid option&lt;BR /&gt;typeset: usage: typeset [-afFirtx] [-p] name[=value] ...&lt;BR /&gt;awk: cmd. line:3: while ((knt &amp;lt; 4) &amp;amp;&amp;amp; "locale LC_TIME 2&amp;gt;/dev/null" | \c&lt;BR /&gt;awk: cmd. line:3:                                                    ^ backslash not last character on line&lt;BR /&gt;00--0000&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I also tried it with a newer version and get the same error.&lt;BR /&gt;&lt;BR /&gt;Any ideas?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;David&lt;BR /&gt;</description>
      <pubDate>Mon, 21 May 2007 15:18:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004412#M64156</guid>
      <dc:creator>David Yandry</dc:creator>
      <dc:date>2007-05-21T15:18:14Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004413#M64157</link>
      <description>Hi David:&lt;BR /&gt;&lt;BR /&gt;Perhaps you fetched a new version from the ITRC; saved in on a Windows platform and FTP'd it in binary mode to a Unix server.  In that case, you have linefeed+carriage-return characters instead of simple linefeeds as your line delimiters.&lt;BR /&gt;&lt;BR /&gt;If you do 'cat -etv file' you will see:&lt;BR /&gt;&lt;BR /&gt;^M$&lt;BR /&gt;&lt;BR /&gt;at the line's termination.&lt;BR /&gt;&lt;BR /&gt;If this is the case, eliminate the carriage returns with:&lt;BR /&gt;&lt;BR /&gt;# dos2ux caljd.sh &amp;gt; caljd.sh.new&lt;BR /&gt;# mv caljd.sh.new caljd.sh&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 21 May 2007 15:29:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004413#M64157</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-21T15:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004414#M64158</link>
      <description>OK David. Fess up. What shell are you trying to run caljd.sh under? This may be yet another opportunity for me to bash bash.&lt;BR /&gt;&lt;BR /&gt;Try using caljd.pl instead. I'll bet that it works.</description>
      <pubDate>Mon, 21 May 2007 15:30:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004414#M64158</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-21T15:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004415#M64159</link>
      <description>Hi JRF:&lt;BR /&gt;&lt;BR /&gt;Thanks for replying but I was careful to download the script.&lt;BR /&gt;&lt;BR /&gt;Hi ACS:&lt;BR /&gt;I am trying to run under bash but that was after it did not work under ksh. I got this output when I tried the same values under ksh.&lt;BR /&gt;&lt;BR /&gt;$ caljd.sh -S "-" -o -e 2454250&lt;BR /&gt;00--0000&lt;BR /&gt;&lt;BR /&gt;I will try the perl version but I would really like to fix the shell version.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;David</description>
      <pubDate>Mon, 21 May 2007 15:40:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004415#M64159</guid>
      <dc:creator>David Yandry</dc:creator>
      <dc:date>2007-05-21T15:40:43Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004416#M64160</link>
      <description>OK David. Fess up some more. This ain't HP-UX is it? My psychic, Miss Cleo, tells me that you are one of them Linux fellers. Why ain't you posting this in Linux where it belongs?&lt;BR /&gt;&lt;BR /&gt;In any event, caljd.pl will work in Linux (or Windows for that matter) and that is what I consider to be the portable caljd.xx version.&lt;BR /&gt;&lt;BR /&gt;Most bash implementations fail with this construct:&lt;BR /&gt;&lt;BR /&gt;echo "Stupid Bash" | read A B&lt;BR /&gt;echo "A = \"${A}\""&lt;BR /&gt;echo "B = \"${B}\""&lt;BR /&gt;&lt;BR /&gt;${B} will be NULL rather than "Bash". You bash boys can argue about lvalues and subprocesses but this is a handy feature for parsing data.&lt;BR /&gt;&lt;BR /&gt;Bash also does not know about "Z" (Zero-padded) variables.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 21 May 2007 15:51:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004416#M64160</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-21T15:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004417#M64161</link>
      <description>Hi ACS:&lt;BR /&gt;&lt;BR /&gt;Yes, I am running redhat linux :(. Is there any way to fix caljd.sh to work on Linux?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;David&lt;BR /&gt;</description>
      <pubDate>Mon, 21 May 2007 16:20:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004417#M64161</guid>
      <dc:creator>David Yandry</dc:creator>
      <dc:date>2007-05-21T16:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004418#M64162</link>
      <description>Hi (again) David:&lt;BR /&gt;&lt;BR /&gt;Well, you now have learned that a shell comes in many flavors and a script written for one insn't necessary portable to under without some work.&lt;BR /&gt;&lt;BR /&gt;As Clay noted, use his Perl version.  That will work without any effort on your part!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 21 May 2007 16:36:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004418#M64162</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-21T16:36:57Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004419#M64163</link>
      <description>Hi (again):&lt;BR /&gt;&lt;BR /&gt;To add:  In fact, I submit that Clay should STOP parallel enhancements to caljd.sh and caljd.pl and only provide NEW features in caljd.pl [ assuming that anything is left of the alphabet :-) ].  In that fashion, this my-shell-ain't-your-shell nonsense would cease!&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 21 May 2007 16:58:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004419#M64163</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-05-21T16:58:05Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004420#M64164</link>
      <description>Well David, Jim has given me something to think about. &lt;BR /&gt;&lt;BR /&gt;I will say that under Linux zsh is the least evil shell that I  have found. Caljd.sh should work under zsh with one change: there is a line inside the AWK() function, "readonly AWKEXE". Comment out that line and zsh should work. Linux has a number of other 'improvements' such as the echo command. By default, echo "Test \c" outputs "Test \c&lt;LF&gt;" whereas in real UNIX, echo "Test \c" outputs "Test ". It would be easy enough to replace -Z variables with a function that pads data and I could probably add something that puts echo in a compatible mode and conditionally handle the &lt;BR /&gt;echo "Stupid Bash" | read A B problem ("feature" if you are a bash guy) but Perl sounds like a whole lot easier answer.&lt;BR /&gt;&lt;BR /&gt;After all, you don't have to know anything about Perl to use caljd.pl, just replace ".sh" in your scripts which call caljd.sh with ".pl" and declare victory.&lt;BR /&gt;&lt;BR /&gt;One thing I will say with absolute confidence is that no version of caljd.sh that I write will ever run under csh.&lt;BR /&gt;&lt;BR /&gt;&lt;/LF&gt;</description>
      <pubDate>Mon, 21 May 2007 17:16:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004420#M64164</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-21T17:16:08Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004421#M64165</link>
      <description>OK David. Here is caljd.sh, Vrsn 2.3 s. Other than bug fixes, (which henceforth will not include "this doesn't work under my shell"), any newer features will be found only in the Perl version of the script.&lt;BR /&gt;&lt;BR /&gt;In any event, if a stupid shell is detected which does not correctly (and I get to define 'correctly') handle &lt;BR /&gt;echo "Stupid Bash" | read A B&lt;BR /&gt;then I execute&lt;BR /&gt;echo "Stupid Bash" &amp;gt; tempfile&lt;BR /&gt;read A B &amp;lt; tempfile&lt;BR /&gt;instead.&lt;BR /&gt;&lt;BR /&gt;Similarly, if a stupid shell is detected which does not execute &lt;BR /&gt;echo "Stupid Bash\c"&lt;BR /&gt;correctly, I assert a shell option which changes the behavior of echo.&lt;BR /&gt;&lt;BR /&gt;I also removed all references to "typeset -Z" because not all shells support -Z (zero-padded) variables. Instead, I call a function to do the padding.&lt;BR /&gt;&lt;BR /&gt;I had already addressed a problem under Solaris. For some reason, Sun missed the memo about 20 years ago that nawk (new awk) could be renamed or linked to awk. For anyone wanting to use the original awk, oawk (old awk) is still available. In any event, if nawk is in the PATH, it will be used otherwise awk will be used.&lt;BR /&gt;</description>
      <pubDate>Tue, 22 May 2007 16:45:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004421#M64165</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-22T16:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004422#M64166</link>
      <description>Hi ACS,&lt;BR /&gt;&lt;BR /&gt;The new version works great on Linux. I tried it under bash and ksh and it worked like a champ!&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;David&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2007 16:24:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004422#M64166</guid>
      <dc:creator>David Yandry</dc:creator>
      <dc:date>2007-05-23T16:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: Date Calculation Failed</title>
      <link>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004423#M64167</link>
      <description>Fine, David. You don't know how relieved I am to know that caljd.sh works under bash.&lt;BR /&gt;&lt;BR /&gt;I suppose I should add that I did add a few comments about how the "shbang" line should be set so that the only change needed for various platforms should be changing the shbang line BUT I consider caljd.pl to be the much more portable answer because the ONLY change that might be needed is a symbolic link from wherever Perl really is to /usr/bin/perl.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 23 May 2007 16:32:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/date-calculation-failed/m-p/4004423#M64167</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2007-05-23T16:32:08Z</dc:date>
    </item>
  </channel>
</rss>

