pathed, a tool to munge the Bash
$PATH environment variable.
PATH environment variable contains a colon-separated list of paths.
pathed - “path editor” - can split the path, append, prepend or remove
elements, remove duplicates and reassemble it.
The result is then printed so you can assign it to the
PATH variable. If
--split is used, each path element is printed on a separate line, so you can
iterate over them, for example.
The path elements can also be checked with
--check to make sure that the
indicated directories exist and are readable.
$ PATH=$(pathed --unique --delete rbenv) $ PATH=$(pathed --append /home/my/bin -a /some/other/bin) $ PATH=$(pathed --prepend /home/my/bin -p /some/other/bin) $ for i in $(pathed --split); do ...; done $ pathed --check $ pathed --man
The initial motivation for writing
pathed came when I tried to install
rbenv was active.
vim wanted to be compiled
with the system ruby, so I was looking for a quick way to remove
$ PATH=$(pathed -d rbenv) brew install vim