Perl call unix shell script

Perl call unix shell script

am 24.11.2004 02:22:47 von linlin107

Hi,

I have a unix shell script like that:

.....
export username=scott
export password=tiger
....

I have a perl script call this shell script, and try to get the value of
username password and use in perl script.

Could you tell me how to do that?

Thanks,
Carl

Re: Perl call unix shell script

am 24.11.2004 21:59:44 von Joe Smith

linlin107 wrote:
> Hi,
>
> I have a unix shell script like that:
>
> ....
> export username=scott
> export password=tiger
> ...
>
> I have a perl script call this shell script, and try to get the value of
> username password and use in perl script.

unix% perldoc -q environment
Found in /usr/lib/perl5/5.8.3/pod/perlfaq8.pod
I {changed directory, modified my environment} in a perl script.
How
come the change disappeared when I exited the script? How do I
get my
changes to be visible?

Unix
In the strictest sense, it can't be done--the script
executes as a
different process from the shell it was started from.
Changes to a
process are not reflected in its parent--only in any
children cre-
ated after the change. There is shell magic that may allow
you to
fake it by eval()ing the script's output in your shell;
check out
the comp.unix.questions FAQ for details.

Re: Perl call unix shell script

am 25.11.2004 10:24:08 von Tintin

"linlin107" wrote in message
news:pJWdnU9wysQXeT7cRVn-ig@rogers.com...
> Hi,
>
> I have a unix shell script like that:
>
> ....
> export username=scott
> export password=tiger
> ...
>
> I have a perl script call this shell script, and try to get the value of
> username password and use in perl script.
>
> Could you tell me how to do that?

$ENV{username}='scott';
$ENV{password}='tiger';

*However*, that leds me to think you are going to be doing Oracle SQL
queries.

Head on over to http://dbi.perl.org/