perl 5.0 alpha 8
[p5sagit/p5-mst-13.2.git] / makedir
CommitLineData
79072805 1#!/bin/sh
2304df62 2# $RCSfile: makedir.SH,v 28453Revision: 4.1 28453Date: 92/08/07 18:24:23 $
79072805 3#
4# $Log: makedir.SH,v $
5# Revision 4.1 92/08/07 18:24:23 lwall
6#
7# Revision 4.0.1.1 92/06/08 14:24:55 lwall
8# patch20: SH files didn't work well with symbolic links
9#
10# Revision 4.0 91/03/20 01:27:13 lwall
11# 4.0 baseline.
12#
13#
14
15export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)
16
17case $# in
18 0)
2304df62 19 echo "makedir pathname filenameflag"
79072805 20 exit 1
21 ;;
22esac
23
24: guarantee one slash before 1st component
25case $1 in
26 /*) ;;
27 *) set ./$1 $2 ;;
28esac
29
30: strip last component if it is to be a filename
31case X$2 in
2304df62 32 X1) set `echo $1 | sed 's:\(.*\)/[^/]*$:\1:'` ;;
79072805 33 *) set $1 ;;
34esac
35
36: return reasonable status if nothing to be created
37if test -d "$1" ; then
38 exit 0
39fi
40
41list=''
42while true ; do
43 case $1 in
44 */*)
45 list="$1 $list"
2304df62 46 set `echo $1 | sed 's:\(.*\)/:\1 :'`
79072805 47 ;;
48 *)
49 break
50 ;;
51 esac
52done
53
54set $list
55
56for dir do
2304df62 57 mkdir $dir >/dev/null 2>&1
79072805 58done