BSD 4_4_Lite1 development
[unix-history] / usr / src / contrib / perl-4.036 / makedir.SH
CommitLineData
9b7d628a
C
1case $CONFIG in
2'')
3 if test ! -f config.sh; then
4 ln ../config.sh . || \
5 ln ../../config.sh . || \
6 ln ../../../config.sh . || \
7 (echo "Can't find config.sh."; exit 1)
8 fi 2>/dev/null
9 . ./config.sh
10 ;;
11esac
12case "$0" in
13*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
14esac
15echo "Extracting makedir (with variable substitutions)"
16rm -f makedir
17$spitshell >makedir <<!GROK!THIS!
18$startsh
19# $RCSfile: makedir.SH,v $$Revision: 4.0.1.1 $$Date: 92/06/08 14:24:55 $
20#
21# $Log: makedir.SH,v $
22# Revision 4.0.1.1 92/06/08 14:24:55 lwall
23# patch20: SH files didn't work well with symbolic links
24#
25# Revision 4.0 91/03/20 01:27:13 lwall
26# 4.0 baseline.
27#
28#
29
30export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
31
32case \$# in
33 0)
34 $echo "makedir pathname filenameflag"
35 exit 1
36 ;;
37esac
38
39: guarantee one slash before 1st component
40case \$1 in
41 /*) ;;
42 *) set ./\$1 \$2 ;;
43esac
44
45: strip last component if it is to be a filename
46case X\$2 in
47 X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
48 *) set \$1 ;;
49esac
50
51: return reasonable status if nothing to be created
52if $test -d "\$1" ; then
53 exit 0
54fi
55
56list=''
57while true ; do
58 case \$1 in
59 */*)
60 list="\$1 \$list"
61 set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
62 ;;
63 *)
64 break
65 ;;
66 esac
67done
68
69set \$list
70
71for dir do
72 $mkdir \$dir >/dev/null 2>&1
73done
74!GROK!THIS!
75$eunicefix makedir
76chmod +x makedir