<?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: Using a perl command within a sh script in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421130#M707201</link>
    <description>That module already exists, and is part of my distributions:&lt;BR /&gt;&lt;BR /&gt;lt09:/home/merijn 105 &amp;gt; perl -MDate::Manip -le'print ParseDate("yesterday")'&lt;BR /&gt;2004111117:21:05&lt;BR /&gt;lt09:/home/merijn 106 &amp;gt; perl -MDate::Manip -le'print ParseDate("now")'&lt;BR /&gt;2004111217:21:19&lt;BR /&gt;lt09:/home/merijn 107 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
    <pubDate>Fri, 12 Nov 2004 11:23:31 GMT</pubDate>
    <dc:creator>H.Merijn Brand (procura</dc:creator>
    <dc:date>2004-11-12T11:23:31Z</dc:date>
    <item>
      <title>Using a perl command within a sh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421124#M707195</link>
      <description>I would like to use the following perl command within a sh script is it possible.&lt;BR /&gt;&lt;BR /&gt;$process_date = $date-&amp;gt;prev;</description>
      <pubDate>Fri, 12 Nov 2004 10:26:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421124#M707195</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2004-11-12T10:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: Using a perl command within a sh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421125#M707196</link>
      <description>perl -e [commands]&lt;BR /&gt;&lt;BR /&gt;will run the commands give from then command line or from within a shell script.&lt;BR /&gt;&lt;BR /&gt;mark</description>
      <pubDate>Fri, 12 Nov 2004 10:29:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421125#M707196</guid>
      <dc:creator>Mark Greene_1</dc:creator>
      <dc:date>2004-11-12T10:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using a perl command within a sh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421126#M707197</link>
      <description>If I understand your question then &lt;BR /&gt;PROCESS_DATE=$(perl -e 'print scalar localtime(time() - 86400)')&lt;BR /&gt;echo "Process Date = ${PROCESS_DATE)"&lt;BR /&gt;&lt;BR /&gt;Plan B.&lt;BR /&gt;&lt;BR /&gt;PROCESS_DATE=$(caljd.sh $(caljd.sh -p 1))&lt;BR /&gt;echo "Process Date = ${PROCESS_DATE)"&lt;BR /&gt;&lt;BR /&gt;Search Forums for caljd.sh</description>
      <pubDate>Fri, 12 Nov 2004 10:38:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421126#M707197</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-11-12T10:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using a perl command within a sh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421127#M707198</link>
      <description>Ooops, that should be:&lt;BR /&gt;echo "Process Date = ${PROCESS_DATE}"&lt;BR /&gt;rather than&lt;BR /&gt;echo "Process Date = ${PROCESS_DATE)"&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2004 10:39:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421127#M707198</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-11-12T10:39:59Z</dc:date>
    </item>
    <item>
      <title>Re: Using a perl command within a sh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421128#M707199</link>
      <description>Thanks Clay, I downloaded your script and once I figure it out I will add it to my program.  I need the date format in yyyymmdd, the process runs at 4AM in the morning and copies a few hundred files with a datestamp of the previous day to different machines.</description>
      <pubDate>Fri, 12 Nov 2004 11:01:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421128#M707199</guid>
      <dc:creator>Belinda Dermody</dc:creator>
      <dc:date>2004-11-12T11:01:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using a perl command within a sh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421129#M707200</link>
      <description>The easiest way to do your date manipulation would be to use the solution posted by ACS, calling localtime() in scalar context.&lt;BR /&gt;Then you have to stick with common date format (same as date prints).&lt;BR /&gt;Otherwise you need to do (very little) postprocessing of the list localtime() returns in list context&lt;BR /&gt;(see "perldoc -f localtime")&lt;BR /&gt; &lt;BR /&gt;However, your intended Perl command looks to me as if you were using some Date manipulation module (like Date::Manip or Date::Calc, or whatever) because you seem to invoke a method call on an object reference.&lt;BR /&gt;For this OO style to work you would need to load the module (if it's not core Perl, what I doubt), and get an object reference first.&lt;BR /&gt; &lt;BR /&gt;Since I don't know what module you are using I'd use this hypothetical module Date::Magic&lt;BR /&gt; &lt;BR /&gt;e.g.&lt;BR /&gt; &lt;BR /&gt;PROCESS_DATE=$(perl -MDate::Magic -e 'print Date::Magic-&amp;gt;new('now')-&amp;gt;prev')&lt;BR /&gt; &lt;BR /&gt;Of course you have to check what module you were using in your script, what the name of the constructor is, and what parameters it takes for object initialization.&lt;BR /&gt;grep your script for lines that have&lt;BR /&gt;lines with 'use' or 'require'.&lt;BR /&gt; &lt;BR /&gt;So I'd think you better stick with localtime()&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2004 11:05:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421129#M707200</guid>
      <dc:creator>Ralph Grothe</dc:creator>
      <dc:date>2004-11-12T11:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Using a perl command within a sh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421130#M707201</link>
      <description>That module already exists, and is part of my distributions:&lt;BR /&gt;&lt;BR /&gt;lt09:/home/merijn 105 &amp;gt; perl -MDate::Manip -le'print ParseDate("yesterday")'&lt;BR /&gt;2004111117:21:05&lt;BR /&gt;lt09:/home/merijn 106 &amp;gt; perl -MDate::Manip -le'print ParseDate("now")'&lt;BR /&gt;2004111217:21:19&lt;BR /&gt;lt09:/home/merijn 107 &amp;gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.Merijn</description>
      <pubDate>Fri, 12 Nov 2004 11:23:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421130#M707201</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-11-12T11:23:31Z</dc:date>
    </item>
    <item>
      <title>Re: Using a perl command within a sh script</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421131#M707202</link>
      <description>Okay, here's the way you do that.&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/sh &lt;BR /&gt;&lt;BR /&gt;PROCESS_DATE=$(perl -e '($mday,$mon,$year) = (localtime(time() - 86400)) [3,4,5]; printf("%04d%02d%02d",$year + 1900,$mon + 1,$mday)')&lt;BR /&gt;echo "Process date = ${PROCESS_DATE}"&lt;BR /&gt;&lt;BR /&gt;If I got all that typed in correctly; it should work. Note that you must add 1900 to the year and 1 to the months as localtime() returns months in the range 0-11 (as does its C counterpart); simularly years are years since 1900 CE. &lt;BR /&gt;&lt;BR /&gt;Plan B:&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;PROCESS_DATE=$(caljd.sh -y -s $(caljd.sh -p 1))&lt;BR /&gt;echo "Process date = ${PROCESS_DATE}"&lt;BR /&gt;&lt;BR /&gt;Invoke as caljd.sh -u for full usage and examples.&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Nov 2004 11:49:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/using-a-perl-command-within-a-sh-script/m-p/3421131#M707202</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-11-12T11:49:13Z</dc:date>
    </item>
  </channel>
</rss>

