diff options
author | tv <tv@iiso> | 2011-09-19 00:20:53 +0200 |
---|---|---|
committer | tv <tv@iiso> | 2011-09-19 00:20:53 +0200 |
commit | 0a5e023f09d53a4bc784865005003768bf21b877 (patch) | |
tree | 2bfb2e55ffa111d5dde0bb20f82fa78820969a5f /util | |
parent | bea490c675a6f6b5d40c4d6be86161dfc13a5f78 (diff) |
//util nextpath: initial commit
Diffstat (limited to 'util')
-rwxr-xr-x | util/bin/nextpath | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/util/bin/nextpath b/util/bin/nextpath new file mode 100755 index 00000000..fbffa894 --- /dev/null +++ b/util/bin/nextpath @@ -0,0 +1,12 @@ +#! /bin/sh +# +# nextpath [component...] +# +# echo $PATH with the components stripped +# +set -euf + +pattern="^\\(${1-}$(shift;for i; do echo -n "\\|$i"; done)\\)$" + +echo -n "$(echo -n "$PATH" | tr : '\n' | grep -v "$pattern")" | tr '\n' : +echo |