mkinstalldirs 633 B

1234567891011121314151617181920212223242526272829303132333435363738
  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 $pathcomp"
  20. mkdir "$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