mkinstalldirs 683 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #! /bin/sh
  2. # mkinstalldirs --- make directory hierarchy
  3. # Author: Noah Friedman <friedman@prep.ai.mit.edu>
  4. # Created: 1993-05-16
  5. # Public domain
  6. errstatus=0
  7. for file
  8. do
  9. set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
  10. shift
  11. pathcomp=
  12. for d
  13. do
  14. pathcomp="$pathcomp$d"
  15. case "$pathcomp" in
  16. -* ) pathcomp=./$pathcomp ;;
  17. esac
  18. if test ! -d "$pathcomp"; then
  19. echo "mkdir -m0755 $pathcomp" 1>&2
  20. mkdir -m0755 "$pathcomp" || lasterr=$?
  21. if test ! -d "$pathcomp"; then
  22. errstatus=$lasterr
  23. fi
  24. fi
  25. pathcomp="$pathcomp/"
  26. done
  27. done
  28. exit $errstatus
  29. # mkinstalldirs ends here