1 1.1 elric #! /bin/sh 2 1.1 elric # mkinstalldirs --- make directory hierarchy 3 1.1 elric # Author: Noah Friedman <friedman (at] prep.ai.mit.edu> 4 1.1 elric # Created: 1993-05-16 5 1.1 elric # Public domain 6 1.1 elric 7 1.1 elric # $Id: mkinstalldirs,v 1.1 2011/04/13 18:15:42 elric Exp $ 8 1.1 elric 9 1.1 elric errstatus=0 10 1.1 elric 11 1.1 elric for file 12 1.1 elric do 13 1.1 elric set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` 14 1.1 elric shift 15 1.1 elric 16 1.1 elric pathcomp= 17 1.1 elric for d 18 1.1 elric do 19 1.1 elric pathcomp="$pathcomp$d" 20 1.1 elric case "$pathcomp" in 21 1.1 elric -* ) pathcomp=./$pathcomp ;; 22 1.1 elric esac 23 1.1 elric 24 1.1 elric if test ! -d "$pathcomp"; then 25 1.1 elric echo "mkdir $pathcomp" 26 1.1 elric 27 1.1 elric mkdir "$pathcomp" || lasterr=$? 28 1.1 elric 29 1.1 elric if test ! -d "$pathcomp"; then 30 1.1 elric errstatus=$lasterr 31 1.1 elric fi 32 1.1 elric fi 33 1.1 elric 34 1.1 elric pathcomp="$pathcomp/" 35 1.1 elric done 36 1.1 elric done 37 1.1 elric 38 1.1 elric exit $errstatus 39 1.1 elric 40 1.1 elric # mkinstalldirs ends here 41