Announcement

Collapse
No announcement yet.

$PATH and the current directory

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    $PATH and the current directory

    In another thread in this sub-forum, someone suggested that ./ should be in one's $PATH for convenience. I commented:
    Originally posted by jlittle View Post
    If you have a blank entry in your $PATH, including starting or ending with the separator colon, that means the cwd. I've done that for three decades. It's only an issue if the cwd is writable by people (or bots or software) you don't trust; we don't do that in a typical linux install.
    To which Kubicle replied:
    Originally posted by kubicle View Post
    I'd still prefer a literal "." for clarity, a blank entry is easier to miss.
    That's a matter of taste, I think (related to how good one's eyesight is :-J); minimalists find less is more clear

    Anyway, the point I'd really like to make is, with bash now one can
    alias path='echo -e ${PATH//:/\\n}'
    For example:
    Code:
    $ path
    /home/john/App/adt-bundle-linux/sdk/platform-tools
    /home/john/App/adt-bundle-linux/sdk/tools
    /home/john/perl5/bin
    
    /home/john/bin
    /usr/lib/x86_64-linux-gnu/qt4/bin
    /usr/local/sbin
    /usr/local/bin
    /usr/sbin
    /usr/bin
    /sbin
    /bin
    /usr/games
    /usr/local/games
    The blank entry is obvious, and I find checking the path much easier. (I find typing ./configure all the time annoying.)

    Kubicle also pointed out
    ...as one might run something malicious by accident (like a browser plugin that places a modified sudo executable in your $HOME).
    Can a plugin really do that? And make it executable? I suppose my point about "we don't do that" applies, in that one gets plugins from not just any place; though if some plugin developer gets hacked, there's a chance malware could be in a plugin.

    Regards, John
    Regards, John Little

    #2
    Originally posted by jlittle View Post
    Can a plugin really do that? And make it executable? I suppose my point about "we don't do that" applies, in that one gets plugins from not just any place; though if some plugin developer gets hacked, there's a chance malware could be in a plugin.
    I didn't actually test the technical viability of such a vector, that was just a from-the-top-of-my-head example of what might be possible. I don't wish to overemphasize that as a huge security concern, though, if one is in the habit of running/installing dubious software/scripts/plugins...one will be in trouble with or without cwd in path.

    That's a nice alias, btw, already stole it.

    Comment


      #3
      Originally posted by jlittle View Post
      I find typing ./configure all the time annoying.
      alias cf='./configure' ?

      Comment


        #4
        Originally posted by kubicle View Post
        That's a nice alias, btw, already stole it.
        Ditto. I like aliases. Added to mine as well.
        Windows no longer obstructs my view.
        Using Kubuntu Linux since March 23, 2007.
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment

        Working...
        X