SYN SYN
[p5sagit/p5-mst-13.2.git] / makedir.SH
CommitLineData
2000072c 1case $CONFIGDOTSH in
8d063cd8 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)
fe14fcc3 8 fi 2>/dev/null
378cc40b 9 . ./config.sh
8d063cd8 10 ;;
11esac
12case "$0" in
13*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
14esac
15echo "Extracting makedir (with variable substitutions)"
bee1dbe2 16rm -f makedir
8d063cd8 17$spitshell >makedir <<!GROK!THIS!
18$startsh
a0d0e21e 19# makedir.SH
8d063cd8 20#
21
22export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
23
24case \$# in
25 0)
26 $echo "makedir pathname filenameflag"
27 exit 1
28 ;;
29esac
30
31: guarantee one slash before 1st component
32case \$1 in
33 /*) ;;
34 *) set ./\$1 \$2 ;;
35esac
36
37: strip last component if it is to be a filename
38case X\$2 in
39 X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
40 *) set \$1 ;;
41esac
42
43: return reasonable status if nothing to be created
44if $test -d "\$1" ; then
45 exit 0
46fi
47
48list=''
49while true ; do
50 case \$1 in
51 */*)
52 list="\$1 \$list"
53 set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
54 ;;
55 *)
56 break
57 ;;
58 esac
59done
60
61set \$list
62
63for dir do
64 $mkdir \$dir >/dev/null 2>&1
65done
66!GROK!THIS!
67$eunicefix makedir
378cc40b 68chmod +x makedir