mkinstalldirs 730 B

12345678910111213141516171819202122232425262728293031323334353637
  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. errstatus=0
  8. for file in ${1+"$@"} ; do
  9. set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
  10. shift
  11. pathcomp=
  12. for d in ${1+"$@"} ; do
  13. pathcomp="$pathcomp$d"
  14. case "$pathcomp" in
  15. -* ) pathcomp=./$pathcomp ;;
  16. esac
  17. if test ! -d "$pathcomp"; then
  18. echo "mkdir $pathcomp" 1>&2
  19. mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
  20. fi
  21. if test ! -d "$pathcomp"; then
  22. errstatus=$lasterr
  23. fi
  24. pathcomp="$pathcomp/"
  25. done
  26. done
  27. exit $errstatus
  28. # mkinstalldirs ends here