"nmkdir" in the Bourne shell
Vincent P. Broman
broman at noscvax.UUCP
Fri Aug 30 03:21:11 AEST 1985
After seeing Bourne shell and C language versions of a program
to create sub-sub-sub directories, it seemed to me that the Cshell
offered the simplest quick implementation, one that only creates
ONE subprocess. It suffices to let mkdir produce all diagnostics.
Voila elegance -
#! /bin/csh -f
# invokes mkdir with all extra args prerequisite to creating the desired d's
set mkarg = ()
while ( $#argv > 0 )
set path = ("$1")
set d = "$1:h"
while ( "$d"X != X && "$d" != "$path[1]" && ! -e "$d" )
set path = ("$d" $path:q)
set d = "$d:h"
end
set mkarg = ($mkarg:q $path:q)
shift
end
/bin/mkdir $mkarg:q
# end
Vincent Broman MILNET: broman at nosc
Analysis Branch, code 632 UUCP: {ihnp4,decvax,akgua,dcdwest,ucbvax}!
Naval Ocean Systems Center sdcsvax!noscvax!broman
San Diego, CA 92152 MaBellNet: (619) 225-2365
More information about the Comp.sources.unix
mailing list