Commit | Line | Data |
79072805 |
1 | #!/bin/sh |
2304df62 |
2 | # $RCSfile: makedir.SH,v 28453Revision: 4.1 28453Date: 92/08/07 18:24:23 $ |
79072805 |
3 | # |
4 | # $Log: makedir.SH,v $ |
5 | # Revision 4.1 92/08/07 18:24:23 lwall |
6 | # |
7 | # Revision 4.0.1.1 92/06/08 14:24:55 lwall |
8 | # patch20: SH files didn't work well with symbolic links |
9 | # |
10 | # Revision 4.0 91/03/20 01:27:13 lwall |
11 | # 4.0 baseline. |
12 | # |
13 | # |
14 | |
15 | export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) |
16 | |
17 | case $# in |
18 | 0) |
2304df62 |
19 | echo "makedir pathname filenameflag" |
79072805 |
20 | exit 1 |
21 | ;; |
22 | esac |
23 | |
24 | : guarantee one slash before 1st component |
25 | case $1 in |
26 | /*) ;; |
27 | *) set ./$1 $2 ;; |
28 | esac |
29 | |
30 | : strip last component if it is to be a filename |
31 | case X$2 in |
2304df62 |
32 | X1) set `echo $1 | sed 's:\(.*\)/[^/]*$:\1:'` ;; |
79072805 |
33 | *) set $1 ;; |
34 | esac |
35 | |
36 | : return reasonable status if nothing to be created |
37 | if test -d "$1" ; then |
38 | exit 0 |
39 | fi |
40 | |
41 | list='' |
42 | while true ; do |
43 | case $1 in |
44 | */*) |
45 | list="$1 $list" |
2304df62 |
46 | set `echo $1 | sed 's:\(.*\)/:\1 :'` |
79072805 |
47 | ;; |
48 | *) |
49 | break |
50 | ;; |
51 | esac |
52 | done |
53 | |
54 | set $list |
55 | |
56 | for dir do |
2304df62 |
57 | mkdir $dir >/dev/null 2>&1 |
79072805 |
58 | done |