2 eval 'exec perl -wS $0 ${1+"$@"}'
5 # mkdir - a perl script to substitute mkdir -p
6 # accepts "/", ":", and "\" as delimiters of subdirectories
7 # options -p (for compatibility)
10 # Copyright (c) 2000 Sun Microsystems, Inc.
18 while ( $#ARGV >= 0 ) {
19 if ( $ARGV[0] eq "-mode" ) {
20 $MODE = oct $ARGV[1] ;
24 elsif ( $ARGV[0] eq "-p" ) {
26 # -p does not do anything, it's supported just for compatibility
30 $ARGV[0] =~ s?
\\|:?
/?g
;
31 @SUBDIRS = split "/", $ARGV[0] ;
34 if ( $SUBDIRS[0] eq "" ) {
38 # absolute path WINDOWS
39 if ( $#SUBDIRS > 1 ) {
40 if ( $SUBDIRS[1] eq "" ) {
41 if ( $SUBDIRS[0] =~ /\w/ ) {
42 chdir "$SUBDIRS[0]:\\" ;
50 if ( -e
$SUBDIRS[0] ) {
51 if ( ! -d
$SUBDIRS[0] ) {
56 mkdir $SUBDIRS[0], $MODE or die "Can't create directory $SUBDIRS[0]"
58 chdir $SUBDIRS[0] or die "Can't cd to $SUBDIRS[0]" ;