Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hello, I was just wondering how if anybody could tell me how I could make my current directory always in my PATH by editing the .profile file? Thanks...
  1. #1
    Just Joined!
    Join Date
    Oct 2009
    Posts
    9

    make current directory always in my PATH

    Hello,

    I was just wondering how if anybody could tell me how I could make my current directory always in my PATH by editing the .profile file?

    Thanks

  2. #2
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Do you mean you want it to be dynamic so when you change to a new directory you want that directory added to your path?
    Linux User #453176

  3. #3
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    "./" refers to the current directory.
    Debian GNU/Linux -- You know you want it.

  4. #4
    Just Joined!
    Join Date
    Oct 2009
    Posts
    9
    yes Kieren

  5. #5
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    You can use the command pwd to get the print name of working directory.

    What is it you're trying to achieve? It seems like an odd request
    Linux User #453176

  6. #6
    Just Joined!
    Join Date
    Oct 2009
    Posts
    9
    because this allows execution of files from my current working directory by typing in only the filename.

  7. #7
    Linux Guru coopstah13's Avatar
    Join Date
    Nov 2007
    Location
    NH, USA
    Posts
    3,149
    I guess OP wants to save the extra keystrokes required "./".

    I would try what GNU-FAN suggested, by putting "./" in the path.

  8. #8
    Just Joined!
    Join Date
    Oct 2009
    Posts
    9
    coopstah13,

    thanks for the reply. Ive tried putting this in the .profile file: PATH=$PATH:./
    but it doesnt work. maybe Im placing it in the wrong spot of the file. Where should I put this command in the .profile file?

    Thank you!

  9. #9
    Linux Guru
    Join Date
    Nov 2007
    Posts
    1,695
    There is a reason the working directory is *not* in the PATH variable.

    Bash - Internal Variables

    The current "working directory", ./, is usually omitted from the $PATH as a security measure.

  10. #10
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    Made a quick test
    Code:
    export PATH=$PATH:./:
    and it worked for me (Debian).
    Debian GNU/Linux -- You know you want it.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...