2 # mkinstalldirs --- make directory hierarchy
3 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
7 # $Id: mkinstalldirs,v 1.3 2001/12/31 22:05:23 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
20 echo "${usage}" 1>&2; exit 0 ;;
23 test $# -eq 0 && { echo "${usage}" 1>&2; exit 1; }
26 -- ) shift; break ;; # stop option processing
27 -* ) echo "${usage}" 1>&2; exit 1 ;; # unknown option
28 * ) break ;; # first non-opt arg
34 set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
40 pathcomp="$pathcomp$d"
42 -* ) pathcomp=./$pathcomp ;;
45 if test ! -d "$pathcomp"; then
46 echo "mkdir $pathcomp"
48 mkdir "$pathcomp" || lasterr=$?
50 if test ! -d "$pathcomp"; then
53 if test ! -z "$dirmode"; then
54 echo "chmod $dirmode $pathcomp"
57 chmod $dirmode "$pathcomp" || lasterr=$?
59 if test ! -z "$lasterr"; then