betweenGo

Cygwin Bash Scripts and Java

by Frank Kim on Aug.08, 2008, under Bash, Cygwin, Java

Running Java scripts in Cygwin bash scripts becomes a little tricky because you want to treat most paths in Cygwin as normal UNIX paths but Java expects DOS paths.  Therefore to get around this you can use the mixed option for cygpath.

For example:

if [ -e /usr/bin/cygpath ] || [ -e /bin/cygpath ]
then
  export FOO=`cygpath --mixed "e:\work\betweengo/target/foo"`
else
  export FOO="e:\work\betweengo/target/foo"
fi

The result on Cygwin is that FOO will be set to “e:/work/betweengo/target/foo” which will work both in DOS and UNIX.

  • Share/Bookmark

Related posts:

  1. Cygwin Bash cannot execute DOS formatted scripts
  2. Maven Assembly Convert Shell Scripts to use UNIX LF’s
  3. Shell Scripts with Windows LF’s Fail in Latest Cygwin
  4. Moving Your Cygwin Installation
  5. Unable to start Cygwin shell from Windows command prompt

:

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!