stow/mkinstalldirs

41 lines
722 B
Text
Raw Permalink Normal View History

2011-11-09 17:38:16 -05:00
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
2011-11-09 17:39:32 -05:00
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
2011-11-09 17:38:16 -05:00
errstatus=0
2011-11-09 17:39:32 -05:00
for file
do
2011-11-09 17:38:16 -05:00
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
2011-11-09 17:39:32 -05:00
for d
do
2011-11-09 17:38:16 -05:00
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
2011-11-09 17:39:32 -05:00
echo "mkdir $pathcomp"
2011-11-09 17:38:16 -05:00
2011-11-09 17:39:32 -05:00
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
2011-11-09 17:38:16 -05:00
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here