| delorie.com/archives/browse.cgi | search |
| X-Recipient: | archive-cygwin AT delorie DOT 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 AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT 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 AT comcast DOT net> |
| To: | <cygwin AT cygwin DOT com> |
| References: | <111910987 DOT 20140214222230 AT mtu-net DOT ru> <52FE6397 DOT 5010105 AT cygwin DOT com> <187072112 DOT 20140214234339 AT mtu-net DOT ru> <20140215125606 DOT GM2246 AT calimero DOT vinschen DOT de> <1745533059 DOT 20140215225708 AT mtu-net DOT ru> <20140216120042 DOT GP2246 AT calimero DOT vinschen DOT de> <40596392 DOT 20140216184131 AT yandex DOT ru> <20140216151107 DOT GT2246 AT calimero DOT vinschen DOT de> <6CF2FC1279D0844C9357664DC5A08BA224229D AT MLBXV06 DOT nih DOT gov> <CAAXzdLXEoNujigUD68xFhQv3XS=dCn_mYnqKnx1M4Rq0bVdhpg AT mail DOT gmail DOT com> |
| Subject: | RE: Little cygpath improvement request |
| Date: | Sun, 16 Feb 2014 17:07:15 -0800 |
| Message-ID: | <BC683B544BF740F4BC7ED21D6FBB0C4C@ahallpc> |
| MIME-Version: | 1.0 |
| 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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |