change de current working directory of my session...

D

david_cantin

Hi,

Is it possible to run a perl script that change my current "session"
working dir? Something like a script that a thing like thar :

$pwd
/home/foo
$./perl_script
$pwd
/usr/local/bin

it's dificult because a new process is started when we run a perl
script, so if the perl script change the cwd, the change will die with
the script...

Ps, My os is AIX 4.3 and 5.2


David
 
B

bxb7668

Hi,

Is it possible to run a perl script that change my current "session"
working dir? Something like a script that a thing like thar :

$pwd
/home/foo
$./perl_script
$pwd
/usr/local/bin

it's dificult because a new process is started when we run a perl
script, so if the perl script change the cwd, the change will die with
the script...

Ps, My os is AIX 4.3 and 5.2


David

Running the script with a "dot space" before it causes it to run in
the current shell. In other words:

.. ./perl_script

(That's: dot space dot slash ... Those dots are hard to see on the
screen)
 
U

Uri Guttman

b> Running the script with a "dot space" before it causes it to run in
b> the current shell. In other words:

b> . ./perl_script

where did you get that strange notion? perl is not shell and that runs
shell code in the current shell. how could a shell run perl code inside
itself?

uri
 
J

Jürgen Exner

bxb7668 said:
Running the script with a "dot space" before it causes it to run in
the current shell. In other words:

. ./perl_script

(That's: dot space dot slash ... Those dots are hard to see on the
screen)

Sure, the dot is short for the shell "source" command.
The only question is: how would a shell interpret a Perl script?

jue
 
J

Joe Smith

bxb7668 said:
Running the script with a "dot space" before it causes it to run in
the current shell. In other words:

. ./perl_script

You're forgetting some very important things:
1) It's ". bash_or_sh_script" for some shells,
2) It's "source csh_or_tcsh_script" for other shells,
3) Neither example above handls perl scripts.
-Joe
 

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

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top