This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygpath -m behaviour change
- From: Robert Klemme <shortcutter at googlemail dot com>
- To: cygwin at cygwin dot com
- Date: Tue, 17 Sep 2013 11:12:17 +0200
- Subject: Re: cygpath -m behaviour change
- Authentication-results: sourceware.org; auth=none
- References: <CAF+hkWo0jXKKLM8pS8gZLG0rak+wcLpWJdS2He2_=MxYb0gpYw at mail dot gmail dot com>
On Mon, Sep 16, 2013 at 11:56 AM, David Griffiths
<david.griffiths@gmail.com> wrote:
>> 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 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
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/
--
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