15 lines
222 B
Plaintext
15 lines
222 B
Plaintext
|
#! /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:^$:/:
|
||
|
'
|