X-Spam-Check-By: sourceware.org
To: cygwin@cygwin.com
From: mwoehlke <mwoehlke@tibco.com>
Subject:  Re: Looking for mkdirhier !
Date:  Tue, 22 Aug 2006 12:32:45 -0500
Lines: 33
Message-ID: <ecff3t$66f$1@sea.gmane.org>
References:  <ecf9gi$eo1$1@sea.gmane.org> <013401c6c60f$44ed2880$a501a8c0@CAM.ARTIMI.COM>
Mime-Version:  1.0
Content-Type:  text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding:  7bit
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.5) Gecko/20060719 Thunderbird/1.5.0.5 Mnenhy/0.7.4.0
In-Reply-To: <013401c6c60f$44ed2880$a501a8c0@CAM.ARTIMI.COM>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

Dave Korn wrote:
> On 22 August 2006 16:57, mwoehlke wrote:
>> Dave Korn wrote:
>>> On 22 August 2006 07:50, Guillaume MARTIN wrote:
>>>> How could I install mkdir in cygwin ?
>>> dk@rainbow /tmp> alias mkdirhier='mkdir -p'
>> ...but you would have to set that alias in whatever this script is...
>> Better:
>>
>> $ cat > /bin/mkdirhier
>> mkdir -p "$@"
>> ^D
>> $ chmod +x /bin/mkdirhier
>>
>> (Note: ^D above means hold 'ctrl' and press 'D')
> 
>   Would be even better if you put a shebang on the first line, in case it's
> invoked from a non-bash shell.

Actually, I intentionally did not use a shebang... 'mkdir -p "$@"' 
should work on any Bourne-like shell, although in this case '#!/bin/sh' 
should suffice.

I'm used to writing portable scripts; anything other than '#!/bin/sh' is 
very non-portable, and if the script needs to be run on Bourne+ (i.e. 
bash or ksh), then the only options are a: try to write a wrapper that 
invokes the script in bash/ksh as a here-doc (or something equally 
ugly), or b: don't use a shebang. I generally pick the latter.

-- 
Matthew
'$ time make world' -> real 5d:14h:37m:5.291s  user 0m:0.000s  sys 
4d:2h:14m:43.712s


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

