delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/09/17/09:06:03

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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=vcdL2LUOssRUXW2V
Vf/7RDrhsOKiN9jNQom+a/bcJJmI3y8nju3cKE6xRrgQXcOhVKaHBmnGcluy5UiE
/tLPWQJxCSzoDxq/ADoD/4IdRo7yfVXjdAz9hG4BIEn4n2S4Nrbi71ZUujz6ptcM
ujaSh1Xe0ZqQHg6m6ttypdWlclI=
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:date:from:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=zxYFr64ohaHtDThQxoA8SR
/LDEE=; b=E8VxGuwvi1K2N5mtrDyUbvzyCIJYwp7eoEp+r21Ffdj7UCMSNH9oO8
RamN1JhU9otFkavBZ3tlYTKycoJ9HrWey9FTWqypRR1uJ9tATvznMKWR2dho47rO
OvwUrGRkaKrJg1ipXJ80O7eIKy4e/ytB+c7TB2TlB6dm0iDwNhC5A=
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=4.8 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,HELO_LH_HOME,KAM_THEBAT,KHOP_THREADED,RDNS_NONE autolearn=no version=3.3.2
X-HELO: smtp.ht-systems.ru
Date: Tue, 17 Sep 2013 17:00:10 +0400
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: Andrey Repin <cygwin AT cygwin DOT com>
Message-ID: <337763713.20130917170010@mtu-net.ru>
To: Robert Klemme <shortcutter AT googlemail DOT com>, cygwin AT cygwin DOT com
Subject: Re: cygpath -m behaviour change
In-Reply-To: <CAM9pMnPLLjZs3RAzg1tOgREH45-vP22tTT_3Pzob86POBXh=UQ@mail.gmail.com>
References: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw AT mail DOT gmail DOT com> <CAM9pMnPLLjZs3RAzg1tOgREH45-vP22tTT_3Pzob86POBXh=UQ AT mail DOT gmail DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Robert Klemme!

>>> Yes, that's exactly right, assuming that 'boo' doesn't exist.
>>
>> Hi, it happens even if boo does exist. To put it in context, the
>> script in question was attempting to determine the current directory:
>>
>> CURRENT_DIR=$(cygpath -ma "${0}"/../)

> I am confused: do they need the current directory or the directory
> where the script resides?  The use of -m also sounds a bit weird to
> me.  I'd rather use -u or -w depending on who is supposed to use the
> value (i.e. a Windows process or a Unix Cygwin process).

I often prefer -m in case I need to pass this path to other, non-cygwin tools.
Though, there's less and less of these cases, thanks to continued effort of
community to provide a wide range of packages.

>> (I didn't write this script but I assume they did this for performance reasons.)

> For the same I'd rather do

> DIR_OF_SCRIPT=$(dirname "$0") && test -d "$DIR_OF_SCRIPT" || exit 1

>> But anyway, as you can see ${0} always exists.

> $ dash -c 'echo $0; for a; do echo "arg: $a"; done'
> dash
> $ dash -c 'echo $0; for a; do echo "arg: $a"; done' bla
> bla
> $ dash -c 'echo $0; for a; do echo "arg: $a"; done' bla foo
> bla
> arg: foo
> $ dash -c 'echo $0; for a; do echo "arg: $a"; done' -- bla foo
> --
> arg: bla
> arg: foo

> Kind regards

> robert



--
WBR,
Andrey Repin (anrdaemon AT yandex DOT ru) 17.09.2013, <16:58>

Sorry for my terrible english...


--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019