i-bash/support/mkdirs

48 lines
1.1 KiB
Text
Raw Normal View History

1996-08-26 18:22:31 +00:00
#! /bin/sh
#
# mkdirs - a work-alike for `mkdir -p'
#
# Chet Ramey
# chet@po.cwru.edu
2002-07-17 14:10:11 +00:00
# Copyright (C) 1996-2002 Free Software Foundation, Inc.
#
2009-01-12 13:36:28 +00:00
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
2002-07-17 14:10:11 +00:00
#
2009-01-12 13:36:28 +00:00
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
2002-07-17 14:10:11 +00:00
#
2009-01-12 13:36:28 +00:00
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
2002-07-17 14:10:11 +00:00
1996-08-26 18:22:31 +00:00
for dir
do
1996-12-23 17:02:34 +00:00
test -d "$dir" && continue
1996-08-26 18:22:31 +00:00
tomake=$dir
1996-12-23 17:02:34 +00:00
while test -n "$dir" ; do
1996-08-26 18:22:31 +00:00
# dir=${dir%/*}
1996-12-23 17:02:34 +00:00
# dir=`expr "$dir" ':' '\(/.*\)/[^/]*'`
if dir=`expr "$dir" ':' '\(.*\)/[^/]*'`; then
tomake="$dir $tomake"
else
dir=
fi
1996-08-26 18:22:31 +00:00
done
for d in $tomake
do
1996-12-23 17:02:34 +00:00
test -d "$d" && continue
echo mkdir "$d"
mkdir "$d"
1996-08-26 18:22:31 +00:00
done
done
exit 0