change de current working directory of my session...

Discussion in 'Perl Misc' started by david_cantin@hotmail.com, Jun 9, 2004.

  1. Guest

    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
    , Jun 9, 2004
    #1
    1. Advertising

  2. bxb7668 Guest

    <> wrote in message
    news:ca7quk$...
    > 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)
    bxb7668, Jun 9, 2004
    #2
    1. Advertising

  3. Uri Guttman Guest

    >>>>> "b" == bxb7668 <> writes:

    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
    Uri Guttman, Jun 9, 2004
    #3
  4. bxb7668 wrote:
    > 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ürgen Exner, Jun 9, 2004
    #4
  5. Joe Smith Guest

    bxb7668 wrote:

    > 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
    Joe Smith, Jun 10, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Manu
    Replies:
    1
    Views:
    6,082
    Natty Gur
    Jul 20, 2003
  2. Chris Mellon

    2.4->2.5 current directory change?

    Chris Mellon, Feb 26, 2007, in forum: Python
    Replies:
    3
    Views:
    396
    Ziga Seilnacht
    Feb 26, 2007
  3. duyanning
    Replies:
    3
    Views:
    642
    R. Bernstein
    Nov 27, 2007
  4. Replies:
    1
    Views:
    109
    Brian McCauley
    Jun 10, 2004
  5. Replies:
    1
    Views:
    107
    Anno Siegel
    Jun 9, 2004
Loading...

Share This Page