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