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: Robert Klemme <shortcutter at googlemail dot com>, cygwin at cygwin dot com
- Date: Tue, 17 Sep 2013 17:00:10 +0400
- Subject: Re: cygpath -m behaviour change
- Authentication-results: sourceware.org; auth=none
- References: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw at mail dot gmail dot com> <CAM9pMnPLLjZs3RAzg1tOgREH45-vP22tTT_3Pzob86POBXh=UQ at mail dot gmail dot com>
- Reply-to: Andrey Repin <cygwin at cygwin dot com>
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@yandex.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