This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygpath -m behaviour change


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]