https://github.com/johnweldon/cleanpath
Go tool to cleanup PATH-like strings.
https://github.com/johnweldon/cleanpath
cleanup cli environment-variables go golang path
Last synced: about 1 year ago
JSON representation
Go tool to cleanup PATH-like strings.
- Host: GitHub
- URL: https://github.com/johnweldon/cleanpath
- Owner: johnweldon
- License: mit
- Archived: true
- Created: 2015-03-07T15:52:10.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-06-14T02:20:00.000Z (about 10 years ago)
- Last Synced: 2024-08-02T15:48:11.309Z (almost 2 years ago)
- Topics: cleanup, cli, environment-variables, go, golang, path
- Language: Go
- Size: 5.86 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cleanpath
Simple tool to clean up PATH like strings by removing redundant and
incorrect entries but keeping the relative order of the paths that
remain.
For example:
```sh
$ export FAKEPATH=/usr/bin:/usr/local/bin:/usr/bin:/usr/sbin:.
$ export FAKEPATH=$(cleanpath $FAKEPATH)
$ echo $FAKEPATH
/usr/bin:/usr/local/bin:/usr/sbin
```
Notice:
1) Redundant paths removed, but relative order of first occurence is maintained.
2) Relative (unsafe) paths removed.
[](https://travis-ci.org/johnweldon/cleanpath)
[](https://godoc.org/github.com/johnweldon/cleanpath)