home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / vile-src.zip / vile-8.1 / mkdirs.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1994-07-11  |  741b  |  36 lines

  1. #!/bin/sh
  2. # mkinstalldirs --- make directory hierarchy
  3. # Author: Noah Friedman <friedman@prep.ai.mit.edu>
  4. # Created: 1993-05-16
  5. # Last modified: 1994-03-25
  6. # Public domain
  7. #
  8. # $Header: /usr2/foxharp/src/pgf/vile/RCS/mkdirs.sh,v 1.2 1994/07/11 22:56:20 pgf Exp $
  9. #
  10.  
  11. errstatus=0
  12.  
  13. for file in ${1+"$@"} ; do 
  14.    set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
  15.    shift
  16.  
  17.    pathcomp=
  18.    for d in ${1+"$@"} ; do
  19.      pathcomp="$pathcomp$d"
  20.      case "$pathcomp" in
  21.        -* ) pathcomp=./$pathcomp ;;
  22.      esac
  23.  
  24.      if test ! -d "$pathcomp"; then
  25.         echo "mkdir $pathcomp" 1>&2
  26.         mkdir "$pathcomp" || errstatus=$?
  27.      fi
  28.  
  29.      pathcomp="$pathcomp/"
  30.    done
  31. done
  32.  
  33. exit $errstatus
  34.  
  35. # mkinstalldirs ends here
  36.