File: mkdirs

package info (click to toggle)
netgen-lvs 1.5.133-1.2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 2,696 kB
  • sloc: ansic: 32,694; sh: 7,621; python: 1,478; makefile: 390; csh: 2; tcl: 2
file content (32 lines) | stat: -rwxr-xr-x 426 bytes parent folder | download | duplicates (10)
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