From 36670f3e1cccad579b994a29320eeb8e287803b7 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 21 May 2015 01:56:08 +0200 Subject: sh: functions -> bin/ --- bin/make-parent-dirs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 bin/make-parent-dirs (limited to 'bin/make-parent-dirs') diff --git a/bin/make-parent-dirs b/bin/make-parent-dirs new file mode 100755 index 000000000..f4717b249 --- /dev/null +++ b/bin/make-parent-dirs @@ -0,0 +1,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 -- cgit v1.2.3