mkinstalldirs 671 B

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