X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:to:references:subject:date:message-id
	:mime-version:content-type:content-transfer-encoding
	:in-reply-to; q=dns; s=default; b=jfhPfbRWtsAiaGb+/sJ8uu5sgl3O92
	xPBCEBDjbUpWZq0wf5IHXJPFUCo1wRCwXrYiMZ0kLmoimvjrC+t83bRHuR7tQouD
	mLFsceSB6oN43wzS9lR4OTwkF7CnFDj/j8yhyLtcVyz+4NZgBocDtfOGA4RlDzU5
	qCvcU13/F8rLQ=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:from:to:references:subject:date:message-id
	:mime-version:content-type:content-transfer-encoding
	:in-reply-to; s=default; bh=CZZEf94Jc8Yupdypojg5Rlf5Ga4=; b=ZlIZ
	98QcANuzjLuqB92m/fF2WP1Yy1RmwUgALq3Uh71YeGyUBoRZMziRP7B2bh57Szrs
	AcBEd1Vx6/RKyxdcWCRkUIWitiVagUVth3CaSbG26L9nt3ldtAfV5fNaQOFH8NNQ
	LP1oQPwN3nnol+YfOQUjn7MWsajh+biyQLsrdFI=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2
X-HELO: qmta13.emeryville.ca.mail.comcast.net
From: "Andy Hall" <fixpertise-consulting@comcast.net>
To: <cygwin@cygwin.com>
References: <111910987.20140214222230@mtu-net.ru>	<52FE6397.5010105@cygwin.com>	<187072112.20140214234339@mtu-net.ru>	<20140215125606.GM2246@calimero.vinschen.de>	<1745533059.20140215225708@mtu-net.ru>	<20140216120042.GP2246@calimero.vinschen.de>	<40596392.20140216184131@yandex.ru>	<20140216151107.GT2246@calimero.vinschen.de>	<6CF2FC1279D0844C9357664DC5A08BA224229D@MLBXV06.nih.gov> <CAAXzdLXEoNujigUD68xFhQv3XS=dCn_mYnqKnx1M4Rq0bVdhpg@mail.gmail.com>
Subject: RE: Little cygpath improvement request
Date: Sun, 16 Feb 2014 17:07:15 -0800
Message-ID: <BC683B544BF740F4BC7ED21D6FBB0C4C@ahallpc>
MIME-Version: 1.0
Content-Type: text/plain;	charset="US-ASCII"
Content-Transfer-Encoding: 7bit
In-reply-to: <CAAXzdLXEoNujigUD68xFhQv3XS=dCn_mYnqKnx1M4Rq0bVdhpg@mail.gmail.com>
X-IsSubscribed: yes

> 
> On Sun, Feb 16, 2014 at 12:30 PM, Buchbinder, Barry (NIH/NIAID) [E] wrote
> > if [ ! -z "$2" ] ; then NATIVE="$(cygpath -ml "$2")" ; fi
> 
> That might better be written as this
> 
>     [ "$2" ] && NATIVE=$(cygpath -ml "$2")
> 
> You do not need the extra quotes when setting a variable in this way.
> 
Goodness. If code cleanliness is the issue, Why not simply hide this construct in a function?

function dospath() {
        [ "$1" ] && cygpath -ml "$1"
}

Then 

NATIVE=$(dospath $1)

Which is about as simple and clear as it gets.


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

