How can I get the full path for the running script (like $0)

Discussion in 'Perl Misc' started by sm, Jan 26, 2006.

  1. sm

    sm Guest

    Hi Folks,
    I need to know the full path to the running script ( $0 provides the name of
    the file)
    is there a way to get the full path.
    for example:
    I run the script "/root/eng/perlscripts/xyz.pl"
    $0 = xyz.pl
    I need a way to know "/root/eng/perlscripts/xyz.pl"

    Thanks
    -sm
     
    sm, Jan 26, 2006
    #1
    1. Advertising

  2. sm

    Guest

    , Jan 26, 2006
    #2
    1. Advertising

  3. sm wrote:
    > Hi Folks,
    > I need to know the full path to the running script ( $0 provides the name of
    > the file)
    > is there a way to get the full path.
    > for example:
    > I run the script "/root/eng/perlscripts/xyz.pl"
    > $0 = xyz.pl
    > I need a way to know "/root/eng/perlscripts/xyz.pl"


    try running the script by specifying the full path when you call it.
     
    it_says_BALLS_on_your_forehead, Jan 26, 2006
    #3
  4. sm <> wrote:

    > I need to know the full path to the running script



    perldoc -q path

    How do I add the directory my program lives in to the module/library
    search path?


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
     
    Tad McClellan, Jan 26, 2006
    #4
    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. Benjamin Han
    Replies:
    7
    Views:
    497
    Hartmut Goebel
    Jan 3, 2004
  2. gmax2006
    Replies:
    7
    Views:
    624
    John Machin
    Aug 31, 2006
  3. Replies:
    4
    Views:
    347
    Keith Thompson
    Jun 21, 2007
  4. kj
    Replies:
    7
    Views:
    373
    Mike Driscoll
    Jun 9, 2008
  5. dude
    Replies:
    5
    Views:
    1,769
    Jussi Piitulainen
    Mar 17, 2011
Loading...

Share This Page