home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / makedir.SH < prev    next >
Text File  |  1999-07-20  |  1KB  |  69 lines

  1. case $CONFIGDOTSH in
  2. '')
  3.     if test ! -f config.sh; then
  4.     ln ../config.sh . || \
  5.     ln ../../config.sh . || \
  6.     ln ../../../config.sh . || \
  7.     (echo "Can't find config.sh."; exit 1)
  8.     fi 2>/dev/null
  9.     . ./config.sh
  10.     ;;
  11. esac
  12. case "$0" in
  13. */*) cd `expr X$0 : 'X\(.*\)/'` ;;
  14. esac
  15. echo "Extracting makedir (with variable substitutions)"
  16. rm -f makedir
  17. $spitshell >makedir <<!GROK!THIS!
  18. $startsh
  19. # makedir.SH
  20.  
  21. export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh \$0; kill \$\$)
  22.  
  23. case \$# in
  24.   0)
  25.     $echo "makedir pathname filenameflag"
  26.     exit 1
  27.     ;;
  28. esac
  29.  
  30. : guarantee one slash before 1st component
  31. case \$1 in
  32.   /*) ;;
  33.   *)  set ./\$1 \$2 ;;
  34. esac
  35.  
  36. : strip last component if it is to be a filename
  37. case X\$2 in
  38.   X1) set \`$echo \$1 | $sed 's:\(.*\)/[^/]*\$:\1:'\` ;;
  39.   *)  set \$1 ;;
  40. esac
  41.  
  42. : return reasonable status if nothing to be created
  43. if $test -d "\$1" ; then
  44.     exit 0
  45. fi
  46.  
  47. list=''
  48. while true ; do
  49.     case \$1 in
  50.     */*)
  51.     list="\$1 \$list"
  52.     set \`echo \$1 | $sed 's:\(.*\)/:\1 :'\`
  53.     ;;
  54.     *)
  55.     break
  56.     ;;
  57.     esac
  58. done
  59.  
  60. set \$list
  61.  
  62. for dir do
  63.     $mkdir \$dir >/dev/null 2>&1
  64. done
  65. !GROK!THIS!
  66. $eunicefix makedir
  67. chmod +x makedir
  68.