This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl 1.0 patch 9: 3 portability problems
[perl5.git] / makedir.SH
CommitLineData
8d063cd8
LW
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
9 . config.sh
10 ;;
11esac
12case "$0" in
13*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
14esac
15echo "Extracting makedir (with variable substitutions)"
16$spitshell >makedir <<!GROK!THIS!
17$startsh
18# $Header: makedir.SH,v 1.0 87/12/18 13:05:32 root Exp $
19#
20# $Log: makedir.SH,v $
21# Revision 1.0 87/12/18 13:05:32 root
22# Initial revision
23#
24# Revision 4.3.1.1 85/05/10 11:35:14 lwall
25# Branch for patches.
26#
27# Revision 4.3 85/05/01 11:42:31 lwall
28# Baseline for release with 4.3bsd.
29#
30
31export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
32
33case \$# in
34 0)
35 $echo "makedir pathname filenameflag"
36 exit 1
37 ;;
38esac
39
40: guarantee one slash before 1st component
41case \$1 in
42 /*) ;;
43 *) set ./\$1 \$2 ;;
44esac
45
46: strip last component if it is to be a filename
47case X\$2 in
48 X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
49 *) set \$1 ;;
50esac
51
52: return reasonable status if nothing to be created
53if $test -d "\$1" ; then
54 exit 0
55fi
56
57list=''
58while true ; do
59 case \$1 in
60 */*)
61 list="\$1 \$list"
62 set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
63 ;;
64 *)
65 break
66 ;;
67 esac
68done
69
70set \$list
71
72for dir do
73 $mkdir \$dir >/dev/null 2>&1
74done
75!GROK!THIS!
76$eunicefix makedir
77chmod 755 makedir