summaryrefslogtreecommitdiffstats
path: root/bin/mkdirs
blob: 685c7c044ab18178ea209a1b1404cce4f959d71d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#! /bin/sh
#
# Copyright (C) 2001
#    National Center for Supercomputing Applications
#    All rights reserved.
#
# This is a small program which will create directories n-levels deep.
# You just call it with something like:
#
#       mkdirs /tmp/foo/bar/baz
#
# and it will create all the directories from /tmp down to baz which
# don't exist.
#
chmodprog="${CHMODPROG-chmod}"
mkdirprog="${MKDIRPROG-mkdir}"

make_dir () {
  if test -d $1; then
    :
  else
    make_dir `echo $1 | sed -e 's#/[^/]*$##'`
    $mkdirprog $1
    $chmodprog 755 $1
  fi
}

make_dir `echo $1 | sed -e 's#/$##'`