Public bug reported:

Binary package hint: bash

adding directories to $PATH is a very common task. it is desirable to
only add a directory to $PATH if it is not already there. sadly that is
quite hard to do. removing directories from $PATH is not as common but
at least as hard.

i think bash should have commands to add directories uniquely to $PATH
and remove from $PATH

for example:
path_append ()  { path_remove $1; export PATH="$PATH:$1"; }
path_prepend () { path_remove $1; export PATH="$1:$PATH"; }
path_remove ()  { export PATH=`echo -n $PATH | awk -v RS=: -v ORS=: '$0 != 
"'$1'"' | sed 's/:$//'`; }

from http://stackoverflow.com/questions/370047/what-is-the-most-elegant-
way-to-remove-a-path-from-the-path-variable-in-bash

it would be better if the commands do not depend on anything outside of
bash

** Affects: bash (Ubuntu)
     Importance: Undecided
         Status: New

-- 
feature request: commands to easily manipulate $PATH
https://bugs.launchpad.net/bugs/619010
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to