mkdirs.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #! /bin/sh
  2. # $Id: mkdirs.sh,v 1.5 2007/03/25 22:29:46 tom Exp $
  3. # -----------------------------------------------------------------------------
  4. # mkinstalldirs --- make directory hierarchy
  5. # Author: Noah Friedman <friedman@prep.ai.mit.edu>
  6. # Created: 1993-05-16
  7. # Last modified: 1994-03-25
  8. # Public domain
  9. # -----------------------------------------------------------------------------
  10. errstatus=0
  11. umask 022
  12. for file in ${1+"$@"} ; do
  13. set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
  14. shift
  15. pathcomp=
  16. for d in ${1+"$@"} ; do
  17. pathcomp="$pathcomp$d"
  18. case "$pathcomp" in
  19. -* ) pathcomp=./$pathcomp ;;
  20. esac
  21. if test ! -d "$pathcomp"; then
  22. echo "mkdir $pathcomp" 1>&2
  23. case "$pathcomp" in
  24. [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]: )
  25. ;; # DOSISH systems
  26. * )
  27. mkdir "$pathcomp"
  28. errstatus=$?
  29. if test $errstatus != 0
  30. then
  31. # may have failed if invoked in a parallel "make -j# install"
  32. if test -d "$pathcomp"
  33. then
  34. errstatus=0
  35. fi
  36. fi
  37. ;;
  38. esac
  39. fi
  40. pathcomp="$pathcomp/"
  41. done
  42. done
  43. exit $errstatus
  44. # mkinstalldirs ends here