| 1 | #!/bin/sh |
| 2 | # Make directory hierarchy. |
| 3 | # Written by Noah Friedman <[email protected]> |
| 4 | # Public domain. |
| 5 | |
| 6 | defaultIFS=' |
| 7 | ' |
| 8 | IFS="${IFS-${defaultIFS}}" |
| 9 | |
| 10 | for file in ${1+"$@"} ; do |
| 11 | oIFS="${IFS}" |
| 12 | # Some sh's can't handle IFS=/ for some reason. |
| 13 | IFS='%' |
| 14 | set - `echo ${file} | sed -e 's@/@%@g' -e 's@^%@/@'` |
| 15 | IFS="${oIFS}" |
| 16 | test ".${1}" = "." && shift |
| 17 | |
| 18 | pathcomp='' |
| 19 | |
| 20 | while test $# -ne 0 ; do |
| 21 | pathcomp="${pathcomp}${1}" |
| 22 | shift |
| 23 | |
| 24 | if test ! -d "${pathcomp}"; then |
| 25 | echo "mkdir $pathcomp" 1>&2 |
| 26 | mkdir "${pathcomp}" |
| 27 | fi |
| 28 | |
| 29 | pathcomp="${pathcomp}/" |
| 30 | done |
| 31 | done |
| 32 | |
| 33 | # eof |