I need to execute ". <some-file> from within a Perl script. he problem is, is that it doesn't execute using system, ` `, or exec.

Just in case someone may ask, "test.out" does get opened and written to, this code executes as root, "oraenv" is an executable with sufficient privileges.

Here's the code:

#!/usr/bin/perl -w use strict; my ( $ScriptName, $TAG ); my $file = "/export/home/scratch/test.out"; my $oratabFile = "/var/opt/oracle/oratab"; my $date = `/bin/date`; open ORATAB, "<$oratabFile" or die "$!\n"; open FILE, ">>$file" or die "$!\n"; my ( $host, $sid, $type ) = split ( '\_', $ENV{NB_ORA_PC_SCHED} ); while ( my $oraLine = <ORATAB> ) { chomp $oraLine; my ( $oraSID, $oraHome, $oraType ) = split ( '\:', $oraLine ); if ( $oraSID = $sid ) { $ENV{ORACLE_HOME} = $oraHome; $ScriptName = "$oraSID" . '_' . "$type.sh"; $TAG = $ENV{NB_ORA_PC_SCHED}; } } $ENV{ORAENV_ASK} = "NO"; $ENV{ORACLE_SID} = $sid; `export ORAENV_ASK ORACLE_SID ORACLE_HOME`; system(". /apps/oracle/bin/oraenv"); #################################### # # # Begin loop which will determine # # what type of backup to run # # # #################################### print FILE "\n\n\n"; print FILE "$ENV{NB_ORA_PC_SCHED} is a COLD backup"; print FILE "\n\n\n"; print FILE "====================================================\n"; print FILE "Printing environmental vars for troubleshooting\n"; print FILE "====================================================\n"; print FILE "\n\n\n"; print FILE `/usr/ucb/printenv`; print FILE "\n\n\n"; print FILE "====================================================\n"; print FILE "End Troubleshooting Section\n"; print FILE "====================================================\n"; print FILE "\n\n\n"; close ORATAB; close FILE;

In reply to How to execute a Korn shell ". <some-file>" from within Perl by blink

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.