blob: 2ed86bdec1746056259bf25d06385deb431daf7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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:^$:/:
'
|