running dot files

H

heylow

Gurus,

I have a dot file that contains the following.


$pwd
/home/oracle
$cat .edp
export ORACLE_HOME=/home/oracle/product/10.2.0/db
export SID=EDP

I have one line perl script.

$cat 1.pl
#!/usr/local/bin/perl
.. ~/.edp

$./1.pl

syntax error at ./1.pl line 2, near "."
Execution of ./1.pl aborted due to compilation errors.


How to get rid of this error?

Thanks
 
U

usenet

export ORACLE_HOME=/home/oracle/product/10.2.0/db
export SID=EDP

This is a shell environment configuration file. Perl doesn't grok
such a file. There are several possibilities to configure your
environment in Perl, including these:

You could source the file and then run the Perl program (all from a
bash script); the Perl program will inherit the shell's environment.
It's kinda ugly, but I do this with cron jobs - the cron invokes a
ksh, which sources the env and runs the Perl program.

Or you can import the settings using a module such as
Shell::EnvImporter (I've never tried this, but it looks like it ought
to do the trick):
http://search.cpan.org/~dfaraldo/Shell-EnvImporter-1.04/lib/Shell/EnvImporter.pm

Or you can configure the environment directly in the Perl program:
$ENV{'ORACLE_HOME'} = '/home/oracle/product/10.2.0/db';
$ENV{SID} = 'EDP';
 
H

heylow

This is a shell environment configuration file. Perl doesn't grok
such a file. There are several possibilities to configure your
environment in Perl, including these:

You could source the file and then run the Perl program (all from a
bash script); the Perl program will inherit the shell's environment.
It's kinda ugly, but I do this with cron jobs - the cron invokes a
ksh, which sources the env and runs the Perl program.

Or you can import the settings using a module such as
Shell::EnvImporter (I've never tried this, but it looks like it ought
to do the trick):
http://search.cpan.org/~dfaraldo/Shell-EnvImporter-1.04/lib/Shell/Env...

Or you can configure the environment directly in the Perl program:
$ENV{'ORACLE_HOME'} = '/home/oracle/product/10.2.0/db';
$ENV{SID} = 'EDP';


Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top