blob: 851ad525c7b3cd13acbb9219f207251d58bc1296 (
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
51
52
53
|
#! /bin/sh
#
# $NetBSD: mkdir-sh,v 1.1.1.1 2006/07/17 14:21:31 jlam Exp $
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin; export PATH
MKDIRCMD=mkdir
cmdargs="$@"
# variable 'options' is unused
for options in p m
do
if [ $# -lt 1 ]
then
${MKDIRCMD} ${cmdargs}
exit $?
fi
case $1 in
-p) pathopt=-p;
shift;;
-m) modeopt="-m ${2}"
shift;
if [ $# -ne 0 ]
then
shift
else
${MKDIRCMD} ${cmdargs}
exit $?
fi
;;
esac
done
if [ $# -gt 0 ]
then
while [ $# -gt 0 ]
do
if [ -z "${pathopt}" ]
then
${MKDIRCMD} ${modeopt} -- "$1"
elif [ ! -d $1 ]
then
${MKDIRCMD} ${pathopt} ${modeopt} -- "$1"
else
: # directory exists, nothing to do
fi
shift
done
else
${MKDIRCMD} ${cmdargs}
fi
|