Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site noscvax.UUCP Path: utzoo!decvax!genrad!panda!talcott!harvard!seismo!lll-crg!dual!qantel!hplabs!sdcrdcf!sdcsvax!noscvax!broman From: broman@noscvax.UUCP (Vincent P. Broman) Newsgroups: net.sources Subject: Re: "nmkdir" in the Bourne shell Message-ID: <1090@noscvax.UUCP> Date: Thu, 29-Aug-85 13:21:11 EDT Article-I.D.: noscvax.1090 Posted: Thu Aug 29 13:21:11 1985 Date-Received: Sat, 31-Aug-85 18:14:47 EDT References: <1052@sdcsvax.UUCP> <309@cxsea.UUCP> <226@tikal.UUCP> Distribution: na Organization: Naval Ocean Systems Center, San Diego Lines: 26 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@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