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