Leon
Leon

Reputation: 739

cygdrive prefix does not work in bash script

/cygdrive/c does not work in my bash script. The lines of code are listed here.

PRGPATH="`dirname "$0"`" exec "${PRGPATH}/../../java" .... "${PRGPATH}/xxxx.jar"

The result is Unable to access jarfile /cygdrive/c/app/xxxx.jar

But if I use ls /cygdrive/c/app/xxxx.jar, it is there. And if I replace /cygdrive/c/ with c:/ then, the script works. Why /cygdrive/c/ does not work in a script?

Upvotes: 1

Views: 872

Answers (1)

andrewdotn
andrewdotn

Reputation: 34833

java.exe is a Windows program that requires Windows-style c:\... paths in its arguments, not Cygwin-style /cygdrive/c/... paths.

Cygwin comes with the cygpath utility to convert between the two paths styles.

Try this instead:

PRGPATH="`dirname "$0"`" exec "${PRGPATH}/../../java" .... "$(cygpath -w "${PRGPATH}/xxxx.jar")"

Upvotes: 2

Related Questions