head	1.1;
access;
symbols;
locks; strict;
comment	@# @;


1.1
date	93.02.26.13.17.11;	author roger;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@#!/bin/sh
# $Id$

# mkdirs
# recursive mkdir
# 
# usage: mkdirs [-e] dirs ...	mkdir for all non-existent parent dirs
#	         -e  prints then names of all dirs that don't exist,
#		     BUT does not mkdir them

if [ $# -gt 0 -a "$1" = "-e" ]
then 	CMD=echo
	shift
else	CMD=mkdir
fi

while [ $# -gt 0 ]
do
	S=$1
	D=$S
	C=
	while :
	do
		if [ ! -d $S ]
		then S=`dirname $S`
		else break
		fi

		if [ "$S" = "/" -o "$S" = "" -o "$S" = "." ]
		then break
		else
			if [ ! -d $S ]
			then C="$S $C"
			fi
		fi
	done
	if [ ! -d $D ]
	then
		$CMD $C $D
	fi
	shift
done
@
