summaryrefslogtreecommitdiffstats
path: root/bin/make-parent-dirs
blob: f4717b2498d8a86e9a74c8c90b4d9306bc169ee8 (plain)
1
2
3
4
5
6
7
8
9
10
#! /bin/sh
# make-parent-dirs : lines path |> lines directory
# List all parent directories of a path.
set -euf

set -- "$(sed -n 's|/[^/]*$||p' | grep . | sort | uniq)"
if echo "$1" | grep -q .; then
  echo "$1"
  echo "$1" | make-parent-dirs
fi