X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Eric Blake Subject: Re: Normalized directory name Date: Thu, 30 Apr 2009 22:28:19 +0000 (UTC) Lines: 27 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Tim McDaniel panix.com> writes: > For tidiness, if nothing else, I'd like to get the normalized form, in > much the same way how, in CMD, I can do > E:\>cd cm\buildutil > and have the prompt become > E:\CM\BuildUtil> In the case of cd, I'm not going to patch bash to do this by default. However, you may be able to figure out how to write a shell function that uses bash's case-insensitive globbing to get something close to what you want: $ shopt -s nocaseglob $ echo src SRC sr[c] SR[C] src SRC src src So, given a name you want to normalize, find a way to rewrite it as a shell glob (easiest way to avoid the glob expanding into multiple files is converting one letter into a one-byte charset). Seems like it would be an easy sed script to write to do that, which in turn can be wrapped by shell functions. But beware that with cygwin 1.7, you can have directories which are case sensitive, in which case the glob may return multiple files. -- Eric Blake -- 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/