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