This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygpath -m behaviour change
- From: Andrey Repin <anrdaemon at yandex dot ru>
- To: David Griffiths <david dot griffiths at gmail dot com>, cygwin at cygwin dot com
- Date: Tue, 17 Sep 2013 00:45:56 +0400
- Subject: Re: cygpath -m behaviour change
- Authentication-results: sourceware.org; auth=none
- References: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw at mail dot gmail dot com>
- Reply-to: Andrey Repin <cygwin at cygwin dot com>
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@yandex.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