[sf-perl] Embedded Perl in a Korn shell program

Loo, Peter # PHX Peter.Loo at source.wolterskluwer.com
Fri May 11 15:27:40 PDT 2007

Here is what I am doing:

YYYYMMDD is a value retrieved from a file.  This file contains the date
of a previously processed file date.

  export YYYY=`echo $YYYYMMDD | cut -c1-4`
  export MM=`echo $YYYYMMDD | cut -c5-6`
  export DD=`echo $YYYYMMDD | cut -c7-8`
  if [ "$YYYY" = "" -o "$MM" = "" -o "$DD" = "" ]; then
    MESSAGE="ERROR: Parsing $YYYYMMDD failed."
    echo "$MESSAGE\n"
    func_Exit $STATUS $LOGFILE
  echo "MM IS:   $MM"
  echo "DD IS:   $DD"
  echo "YYYY IS: $YYYY\n"

  MMDD=`perl -MTime::Local -MPOSIX -le \
          '$secs = timelocal(0,0,0,$ENV{DD},$ENV{MM}-1,$ENV{YYYY}) +
86400; \
          print strftime("%m%d", localtime($secs))'`
  echo "MMDD IS: $MMDD\n"


Then the IN_FILE is used further in the Korn shell.

-----Original Message-----
From: sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.org
[mailto:sanfrancisco-pm-bounces+peter.loo=source.wolterskluwer.com at pm.or
g] On Behalf Of Andy Lester
Sent: Friday, May 11, 2007 3:11 PM
To: San Francisco Perl Mongers User Group
Subject: Re: [sf-perl] Embedded Perl in a Korn shell program

On May 11, 2007, at 5:01 PM, Loo, Peter # PHX wrote:

> Thanks Adam.  I am afraid I don't have the luxury of using "date"  
> utility in my Sun Unix OS.  :D

What are you going to do with this date when you're done with it?   
Take a look here at what I did where I thought I needed to build a date,
but I didn't really: http://petdance.livejournal.com/ 124373.html  It's
in edge_walker's response.

Andy Lester => andy at petdance.com => www.petdance.com => AIM:petdance

SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org

This E-mail message is for the sole use of the intended recipient(s) and
may contain confidential and privileged information.  Any unauthorized
review, use, disclosure or distribution is prohibited.  If you are not
the intended recipient, please contact the sender by reply E-mail, and
destroy all copies of the original message.

More information about the SanFrancisco-pm mailing list