-
Notifications
You must be signed in to change notification settings - Fork 0
/
makedir.SH
57 lines (49 loc) · 931 Bytes
/
makedir.SH
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
case $CONFIG in
'') . ./config.sh ;;
esac
echo "Extracting makedir (with variable substitutions)"
$spitshell >makedir <<!GROK!THIS!
$startsh
#
# makedir
#
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)
case \$# in
0)
$echo "makedir pathname filenameflag"
exit 1
;;
esac
: guarantee one slash before 1st component
case \$1 in
/*) ;;
*) set ./\$1 \$2 ;;
esac
: strip last component if it is to be a filename
case X\$2 in
X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
*) set \$1 ;;
esac
: return reasonable status if nothing to be created
if $test -d "\$1" ; then
exit 0
fi
list=''
while : ; do
case \$1 in
*/*)
list="\$1 \$list"
set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
;;
*)
break
;;
esac
done
set \$list
for dir do
$mkdir \$dir >/dev/null 2>&1
done
!GROK!THIS!
$eunicefix makedir
chmod +x makedir