126497Sache#! /bin/sh
226497Sache#
326497Sache# mkdirs - a work-alike for `mkdir -p'
426497Sache#
526497Sache# Chet Ramey
626497Sache# chet@po.cwru.edu
726497Sache
8119610Sache# Copyright (C) 1996-2002 Free Software Foundation, Inc.
9119610Sache#
10119610Sache# This program is free software; you can redistribute it and/or modify
11119610Sache# it under the terms of the GNU General Public License as published by
12119610Sache# the Free Software Foundation; either version 2, or (at your option)
13119610Sache# any later version.
14119610Sache#
15119610Sache# This program is distributed in the hope that it will be useful,
16119610Sache# but WITHOUT ANY WARRANTY; without even the implied warranty of
17119610Sache# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18119610Sache# GNU General Public License for more details.
19119610Sache#
20119610Sache# You should have received a copy of the GNU General Public License
21119610Sache# along with this program; if not, write to the Free Software
22119610Sache# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
23119610Sache
2426497Sachefor dir
2526497Sachedo
2626497Sache
2726497Sache	test -d "$dir" && continue
2826497Sache
2926497Sache	tomake=$dir
3026497Sache	while test -n "$dir" ; do
3126497Sache		# dir=${dir%/*}
3226497Sache		# dir=`expr "$dir" ':' '\(/.*\)/[^/]*'`
3326497Sache		if dir=`expr "$dir" ':' '\(.*\)/[^/]*'`; then
3426497Sache			tomake="$dir $tomake"
3526497Sache		else
3626497Sache			dir=
3726497Sache		fi
3826497Sache	done
3926497Sache
4026497Sache	for d in $tomake
4126497Sache	do
4226497Sache		test -d "$d" && continue
4326497Sache		echo mkdir "$d"
4426497Sache		mkdir "$d"
4526497Sache	done
4626497Sachedone
4726497Sache
4826497Sacheexit 0
49