summaryrefslogtreecommitdiff
path: root/conf/mkdirp
blob: b0e04b05d042ff2cac52732830b1ea16e7e86242 (plain)
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
#!/bin/sh
#
# this is a wrapper for difficult mkdir programs...
#

for d in $*
do
	if [ ! -d $d ]; then
		mkdir -p $d
		if [ $? -ne 0 ]; then exit $? ; fi
	fi
done

exit 0

##########################################################################
# if your mkdir does not support the -p option delete the above lines and
# use what follows:
--------------------
#!/bin/sh

#VERBOSE=yes
Cwd=`pwd`

for d in $*
do
	if [ "`echo $d|cut -c1`" != "/" ]; then 
		x=`pwd`/$d
	else
		x=$d
	fi
	x="`echo $x|sed -e 'yX/X X'`"
	cd /
	for s in $x
	do
		if [ -d $s ]; then
			if [ -n "$VERBOSE" ]; then echo -n "[$s/]"; fi
			cd $s
		else
			mkdir $s
			if [ $? -ne 0 ]; then exit $? ; fi
			if [ -n "$VERBOSE" ]; then echo -n "$s/"; fi
			cd $s
		fi
	done
	if [ -n "$VERBOSE" ]; then echo ; fi
	cd $Cwd
done

exit 0