From 36670f3e1cccad579b994a29320eeb8e287803b7 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 21 May 2015 01:56:08 +0200 Subject: sh: functions -> bin/ --- bin/undot-paths | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100755 bin/undot-paths (limited to 'bin/undot-paths') diff --git a/bin/undot-paths b/bin/undot-paths new file mode 100755 index 00000000..2ed86bde --- /dev/null +++ b/bin/undot-paths @@ -0,0 +1,14 @@ +#! /bin/sh +# undot_paths : lines path |> lines path +# Remove all dots (. and ..) from input paths. +set -euf + +sed ' + :0 + s://\+:/:g + s:/\.\(/\|$\):\1:g + s:/[^/]\+/\.\.\(/\|$\):\1:g + s:^/\(\.\./\)\+:/: + t0 + s:^$:/: +' -- cgit v1.2.3