mkinstalldirs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #! /bin/sh
  2. # Copyright (C) 2016 and later: Unicode, Inc. and others.
  3. # License & terms of use: http://www.unicode.org/copyright.html
  4. # ********************************************************************
  5. # * COPYRIGHT:
  6. # * Copyright (c) 2002-2004, International Business Machines Corporation and
  7. # * others. All Rights Reserved.
  8. # ********************************************************************
  9. # mkinstalldirs --- make directory hierarchy
  10. # Author: Noah Friedman <friedman@prep.ai.mit.edu>
  11. # Created: 1993-05-16
  12. # Public domain
  13. errstatus=0
  14. for file
  15. do
  16. set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
  17. shift
  18. pathcomp=
  19. for d
  20. do
  21. pathcomp="$pathcomp$d"
  22. case "$pathcomp" in
  23. -* ) pathcomp=./$pathcomp ;;
  24. esac
  25. if test ! -d "$pathcomp"; then
  26. echo "mkdir $pathcomp"
  27. mkdir "$pathcomp" || lasterr=$?
  28. if test ! -d "$pathcomp"; then
  29. errstatus=$lasterr
  30. fi
  31. fi
  32. pathcomp="$pathcomp/"
  33. done
  34. done
  35. exit $errstatus
  36. # mkinstalldirs ends here