blob: d2d78a5bc40cc796fc3ed757f28caab2d5b76f41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#!/bin/sh
while read -r line; do
if [ -n "$paths" ]; then
paths="$paths
$line"
else
paths="$line"
fi
done
dirs="$paths"
while [ "$dirs" != '.' ]; do
[ -n "$dirs" ] && paths="$paths
$dirs"
dirs="$(echo "$dirs" | tr '\n' '\0' | xargs -0 dirname | awk '!a[$0]++')"
done
echo "$paths" | awk '!a[$0]++' | grep -v '^\.$'
|