I have a script that reads in the files of a directory, looks for specific files (based upon the filename), then prints those files out. Now in the .profile of the user, I have an environment variable called PDPRINTER set, so that I can use a special command to print out the report double-sided. When I run this script from the command line, I have absolutely no problems. However, when I run it from cron, it doesn't work(i.e. the files don't print, although the directory listing that I print using lpr does). The O.S. is HP-UX 11.0 with Perl 5.6.1
#!/opt/perl5/bin/perl -w use strict; use File::Slurp; my $DIR="/home/mis/ftpstore"; my @Files=read_dir($DIR); my $file; @Files=sort{$a cmp $b}@Files; system("ls -l $DIR/Unity*.prpt | lpr"); foreach $file(@Files){ if($file=~/Unity\d{3}\.prpt/){ ## This command is a specialized command for the ## HP Distributed Print Service. system("pdpr -x sides=2 $DIR/$file"); } }
Any suggestions or ideas are welcome. Thanks.

TStanley
--------
There's an infinite number of monkeys outside who want to talk to us
about this script for Hamlet they've worked out
-- Douglas Adams/Hitchhiker's Guide to the Galaxy

In reply to Not accepting the environment variable by TStanley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.