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: Is this supposed to work this way?


Andrey Repin sent the following at Tuesday, April 03, 2012 3:21 PM
>[Z:\]$ assoc .sh
>.sh=unixshell.script
>
>[Z:\]$ ftype unixshell.script
>unixshell.script="C:/Programs/Cygwin/bin/env.exe" "%1" %*
>
>[Z:\]$ testcase.sh
>++ readlink -fn 'Z:\testcase.sh'
>+ XXX='/z/Z:\testcase.sh'
>+ echo '/z/Z:\testcase.sh'
>/z/Z:\testcase.sh
>++ dirname '/z/Z:\testcase.sh'
>+ XXX=/z/Z:
>+ echo /z/Z:
>/z/Z:
>+ ls -l /z/Z:
>ls: cannot access /z/Z:: No such file or directory
>
>The "testcase.sh" is very simple.
>
>#! /bin/sh
>set -x
>XXX=${XXX:=$(readlink -fn "$0")}
>echo $XXX
>XXX=$(dirname "$XXX")
>echo $XXX
>ls -l "$XXX"
>
>I can combat this by
>XXX=$(cygpath -alm "$0")
>XXX=${XXX:=$(readlink -fn "$0")}
>
>but then my script losing portability. (Namely, I can't "set -e" it then.)
>Any suggestions, perhaps?

Is there a reason that something like the following wouldn't work?

if [ -f /bin/cygwin1.dll ]
then
else
fi

>Sorry for my terrible english...

Not at all terrible.

Best wishes,

- Barry
  Disclaimer: Statements made herein are not made on behalf of NIAID.

--
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]