summaryrefslogtreecommitdiffstats
path: root/util/bin/nextpath
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2011-09-20 17:19:25 +0200
committermakefu <github@syntax-fehler.de>2011-09-20 17:19:25 +0200
commit32ddd0b2dec60ac99e30e26819e4653ccc47690e (patch)
tree6745bd80ed8392f0165a026215268ca24d3ce5c5 /util/bin/nextpath
parentdfadcd3b21d838c9d1bb8fc37304cec71e7517d8 (diff)
parentfcbb481cbd888d6ab66b09e649c754a012198e53 (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'util/bin/nextpath')
-rwxr-xr-xutil/bin/nextpath12
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