Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Getting the absolute path of a script, without PWD

by ikegami (Patriarch)
on Jul 16, 2021 at 00:29 UTC ( [id://11135051]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #include <unistd.h>
    #include <stdio.h>
    ...
    
       return 0;
    }
    
  2. or download this
    [~/sym1]$ gcc -Wall -Wextra -pedantic a.c -o a && ./a
    Current working dir: /home/ikegami/dir1
    
  3. or download this
    [~/sym1]$ readlink /proc/$$/cwd
    /home/ikegami/dir1
    
  4. or download this
    #include <unistd.h>
    #include <stdio.h>
    ...
    
       return 0;
    }
    
  5. or download this
    [~/sym1]$ gcc -Wall -Wextra -pedantic a.c -o a && ./a
    Current working dir: /home/ikegami/dir1
    
  6. or download this
    use 5.010;
    use Path::Tiny qw( path );
    say path($0)->absolute($ENV{PWD});
    
  7. or download this
    [~/sym1]$ perl a.pl
    /home/ikegami/sym1/a.pl
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11135051]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-18 07:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found