mkinstalldirs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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
  31. #! /bin/sh
  32. # mkinstalldirs --- make directory hierarchy
  33. # Author: Noah Friedman <friedman@prep.ai.mit.edu>
  34. # Created: 1993-05-16
  35. # Public domain
  36. # $Id: mkinstalldirs,v 1.2 2000/11/13 00:30:49 christos Exp $
  37. errstatus=0
  38. for file
  39. do
  40. set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
  41. shift
  42. pathcomp=
  43. for d
  44. do
  45. pathcomp="$pathcomp$d"
  46. case "$pathcomp" in
  47. -* ) pathcomp=./$pathcomp ;;
  48. esac
  49. if test ! -d "$pathcomp"; then
  50. echo "mkdir $pathcomp"
  51. mkdir "$pathcomp" || lasterr=$?
  52. if test ! -d "$pathcomp"; then
  53. errstatus=$lasterr
  54. fi
  55. fi
  56. pathcomp="$pathcomp/"
  57. done
  58. done
  59. exit $errstatus