delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/09/16/16:50:29

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=ahjC0Hr+h27gi29a
RZlNH5/M5DWqtSUoTaNNpqaiR3OKulTlH14ozL+9WLQ5uYWYP3ek+fPZfZAzeL/Z
LnlW1Nd0CIqDf43RU2SiSPyaWjr1brzzJomhxEAiPoGNi8xMveXfOvAV+YYjWtJ3
zm+QXqT2x4pdLZ/zseQGYsuJpYs=
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=mXNOCQN+KNyMftPFHYmLEl
yDjrQ=; b=addhZs39Z/DTBn9iDDUxsGdp3gLQ+ucujKxGeuiZ7rummNxAO/1rRB
6D1X1j4O6GH12NyvU4FnP0uzWFTpk0n3+S38VGzW0gp8EPPQ6kkcthTg1S071hHs
kvv2hi71HFJSWe6Ht0VKu1/L+FM2baWu5MLz3O7bcN8Kjf3Q4pwgg=
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: Yes, score=6.2 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,FSL_HELO_BARE_IP_1,FSL_HELO_BARE_IP_2,HELO_MISC_IP,KAM_THEBAT,KHOP_THREADED,RDNS_NONE autolearn=no version=3.3.2
X-HELO: smtp.ht-systems.ru
Date: Tue, 17 Sep 2013 00:45:56 +0400
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: Andrey Repin <cygwin AT cygwin DOT com>
Message-ID: <16710079158.20130917004556@mtu-net.ru>
To: David Griffiths <david DOT griffiths AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: cygpath -m behaviour change
In-Reply-To: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw@mail.gmail.com>
References: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw AT mail DOT gmail DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, David Griffiths!

>> 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 didn't write this script but I assume they did this for performance reasons.)

Glad you didn't... Because otherwise you would be the one to blame for the
problem.
$0 could easily NOT have any path, just a script name.

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

Only theoretically.
Practice is that noone will bet a buck on it.

> I looked at the other thread but don't see an immediate connection as
> that was checking for non-existing path members.

If you want to obtain a full name of a running script, you'd need something
like this:

XXX="$(cygpath -au "$0")"
SCRIPT_NAME="$(readlink -fn "${XXX:-$0}")"

This is almost platform-independent, even. To the extent of readlink -f option
support.


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

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