2 # mkinstalldirs --- make directory hierarchy
3 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
12 Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
14 # process command line arguments
15 while test $# -gt 0 ; do
17 -h | --help | --h*) # -h for help
23 test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
27 --) # stop option processing
35 *) # first non-opt arg
43 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
49 pathcomp="$pathcomp$d"
51 -*) pathcomp=./$pathcomp ;;
54 if test ! -d "$pathcomp"; then
55 echo "mkdir $pathcomp"
57 mkdir "$pathcomp" || lasterr=$?
59 if test ! -d "$pathcomp"; then
62 if test ! -z "$dirmode"; then
63 echo "chmod $dirmode $pathcomp"
65 chmod "$dirmode" "$pathcomp" || lasterr=$?
67 if test ! -z "$lasterr"; then
84 # mkinstalldirs ends here