2 # mkinstalldirs --- make directory hierarchy
3 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
7 # $Sudo: mkinstalldirs,v 1.5 2003/04/03 15:16:22 millert Exp $
14 Usage: mkinstalldirs [-h] [--help] [-m mode] dir ..."
16 # process command line arguments
17 while test $# -gt 0 ; do
19 -h | --help | --h*) # -h for help
25 test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
29 --) # stop option processing
37 *) # first non-opt arg
45 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
51 pathcomp="$pathcomp$d"
53 -*) pathcomp=./$pathcomp ;;
56 if test ! -d "$pathcomp"; then
57 echo "mkdir $pathcomp"
59 mkdir "$pathcomp" || lasterr=$?
61 if test ! -d "$pathcomp"; then
64 if test ! -z "$dirmode"; then
65 echo "chmod $dirmode $pathcomp"
67 chmod "$dirmode" "$pathcomp" || lasterr=$?
69 if test ! -z "$lasterr"; then
86 # mkinstalldirs ends here