File: mkdirs

package info (click to toggle)
readline4 4.2a-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 3,732 kB
  • ctags: 2,379
  • sloc: ansic: 16,932; perl: 4,105; sh: 3,648; makefile: 1,163
file content (32 lines) | stat: -rwxr-xr-x 427 bytes parent folder | download | duplicates (34)
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
29
30
31
32
#! /bin/sh
#
# mkdirs - a work-alike for `mkdir -p'
#
# Chet Ramey
# chet@po.cwru.edu

for dir
do

	test -d "$dir" && continue

	tomake=$dir
	while test -n "$dir" ; do
		# dir=${dir%/*}
		# dir=`expr "$dir" ':' '\(/.*\)/[^/]*'`
		if dir=`expr "$dir" ':' '\(.*\)/[^/]*'`; then
			tomake="$dir $tomake"
		else
			dir=
		fi
	done

	for d in $tomake
	do
		test -d "$d" && continue
		echo mkdir "$d"
		mkdir "$d"
	done
done

exit 0