l4ka-pistachio/tools/mkdirhier

38 lines
717 B
Bash
Executable File

#!/bin/sh
######################################################################
##
## Copyright (C) 2001, Karlsruhe University
##
## File path: mkdirhier
## Description: Make directory hierarchies of input names
##
## @LICENSE@
##
## $Id: mkdirhier,v 1.2 2007/06/11 12:48:24 stoess Exp $
##
######################################################################
IFS="/"
err=
for dir
do
case "$dir" in
-*) dir="./$dir";;
esac
pfx=
path=
for filename in $dir
do
path="$pfx$filename"
pfx="$path/"
if test ! -z "$path" -a ! -d "$path"
then
mkdir -p "$path" || err=$?
fi
done
done
exit $err