delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/08/05/19:48:04

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Kurt Franke <Kurt-Franke AT web DOT de>
Subject: Re: environment variables derived from TMPDIR
Date: Tue, 5 Aug 2008 23:46:59 +0000 (UTC)
Lines: 44
Message-ID: <loom.20080805T232430-609@post.gmane.org>
References: <18584 DOT 12950 DOT 943391 DOT 75971 AT gepard2 DOT akutech-local DOT de>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hi Ralf,


Ralf Fassel <ralfixx <at> gmx.de> writes:

> 
> In a SHELL script I prepare a temp file to pass to some non-cygwin
> program:
> 
>     # TMPDIR is set to c:/temp outside of cygwin
>     # which translates to /cygdrive/c/temp inside cygwin
>     # prepare input
>     TMPFILE=$TMPDIR/foo.$$
>     cat > "$TMPFILE" <<\EOF
>     some stuff
>     EOF
>     # call program: error: no such file /cygdrive/c/temp/foo.1234
>     # filename should be c:/temp/foo.1234
>     external_program "$TMPFILE"
> 
> Now TMPFILE is passed to the external program using POSIX path
> notation which it does not understand.
> 
> If possible I'd like to avoid using 'cygpath' in the script since it
> should run on different platforms.
> 

you may check if the cygpath usage is valid before do it:

is_CYGWIN=`uname | grep CYGWIN | wc -l`
if [ $is_CYGWIN -gt 0 ]
then
  TMPDIR=`cygpath -w $TMPDIR`
fi
# continue with your code here


regards

kf





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019