mkinstalldirs 722 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
  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