2
0

mkdir.sh 980 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/sh
  2. ##
  3. ## mkdir.sh -- make directory hierarchy
  4. ##
  5. ## Based on `mkinstalldirs' from Noah Friedman <friedman@prep.ai.mit.edu>
  6. ## as of 1994-03-25, which was placed in the Public Domain.
  7. ## Cleaned up for Apache's Autoconf-style Interface (APACI)
  8. ## by Ralf S. Engelschall <rse@apache.org>
  9. ##
  10. #
  11. # This script falls under the Apache License.
  12. # See http://www.apache.org/docs/LICENSE
  13. umask 022
  14. errstatus=0
  15. for file in ${1+"$@"} ; do
  16. set fnord `echo ":$file" |\
  17. sed -e 's/^:\//%/' -e 's/^://' -e 's/\// /g' -e 's/^%/\//'`
  18. shift
  19. pathcomp=
  20. for d in ${1+"$@"}; do
  21. pathcomp="$pathcomp$d"
  22. case "$pathcomp" in
  23. -* ) pathcomp=./$pathcomp ;;
  24. ?: ) pathcomp="$pathcomp/"
  25. continue ;;
  26. esac
  27. if test ! -d "$pathcomp"; then
  28. echo "mkdir $pathcomp" 1>&2
  29. mkdir "$pathcomp" || errstatus=$?
  30. fi
  31. pathcomp="$pathcomp/"
  32. done
  33. done
  34. exit $errstatus