2 # mkinstalldirs --- make directory hierarchy
3 # Original author: Noah Friedman <friedman@prep.ai.mit.edu>
7 scriptversion=2003-06-14.23
13 Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
15 Create each directory DIR (with mode MODE, if specified), including all
16 leading file name components.
19 # process command line arguments
20 while test $# -gt 0 ; do
22 -h | --help | --h*) # -h for help
28 test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
33 echo "$0 $scriptversion"
36 --) # stop option processing
44 *) # first non-opt arg
52 if test -d "$file"; then
65 if mkdir -p -- . 2>/dev/null; then
71 if mkdir -m "$dirmode" -p -- . 2>/dev/null; then
72 echo "mkdir -m $dirmode -p -- $*"
73 exec mkdir -m "$dirmode" -p -- "$@"
80 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
86 pathcomp="$pathcomp$d"
88 -*) pathcomp=./$pathcomp ;;
91 if test ! -d "$pathcomp"; then
92 echo "mkdir $pathcomp"
94 mkdir "$pathcomp" || lasterr=$?
96 if test ! -d "$pathcomp"; then
99 if test ! -z "$dirmode"; then
100 echo "chmod $dirmode $pathcomp"
102 chmod "$dirmode" "$pathcomp" || lasterr=$?
104 if test ! -z "$lasterr"; then
111 pathcomp="$pathcomp/"
120 # eval: (add-hook 'write-file-hooks 'time-stamp)
121 # time-stamp-start: "scriptversion="
122 # time-stamp-format: "%:y-%02m-%02d.%02H"
123 # time-stamp-end: "$"