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]

Is this supposed to work this way?


Greetings, All!

[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?


-- 
WBR,
Andrey Repin (anrdaemon@freemail.ru) 03.04.2012, <23:10>

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]