public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Gary Johnson <garyjohn@spocom.com>
To: cygwin@cygwin.com
Subject: Re: Portable shell code between Cygwin and Linux
Date: Mon, 08 Aug 2011 22:17:00 -0000	[thread overview]
Message-ID: <20110808222108.GA1184@KCJs-Computer> (raw)
In-Reply-To: <4E3F44D2.3040501@cs.umass.edu>

On 2011-08-07, Eliot Moss wrote:
> On 8/7/2011 9:16 PM, Sven Köhler wrote:
> >Am 30.07.2011 14:14, schrieb Andrey Repin:
> >>Greetings, Corinna Vinschen!
> >>
> >>>>For every shell code that I write, I'd like it to be portable both to 
> >>>>Cygwin
> >>>>on Windows, and to Ubuntu Linux for example.
> >>>>
> >>>>It's kinda possible, but am blocked with such a use case:
> >>>>
> >>>>alias vpnup='exec sudo openvpn --config ~/config/client.vpn --writepid 
> >>>>/tmp/openvpn.pid&'
> >>>>
> >>>>While this worked perfectly under Ubuntu, I've had to make up a 
> >>>>customized
> >>>>version for Windows:
> >>>>
> >>>>alias vpnupwin='cd c:/home/sva/config; openvpn --config client.vpn 
> >>>>--writepid c:/cygwin/tmp/openvpn.pid&'
> >>
> >>>Don't use Win32 paths.  Use POSIX paths:
> >>
> >>>   alias vpnupwin='cd /cygdrive/c/home/sva/config; openvpn --config 
> >>>   client.vpn --writepid /cygdrive/c/cygwin/tmp/openvpn.pid&'
> >>
> >>Moreover, the very first line is wrong.
> >>
> >>Must be
> >>
> >>alias vpnup='exec sudo openvpn --config $HOME/config/client.vpn 
> >>--writepid /tmp/openvpn.pid&'
> >>
> >>that's where his problem began, IMO.
> >
> >I don't know, why you pointed that out. It's of no use to feed a path
> >like $HOME/something to a pure win32 binary.
> >(Certainly, this hint is kind of important for the ubuntu version of the
> >script, but not for the cygwin issue, which is solely because he's
> >mixing cygwin and win32 and expects it work without any complication)
> 
> The OP *was* seeking uniform scripts between cygwin and ubuntu, but where
> some of the programs invoked under cygwin are Windows programs (which
> therefore need Windows paths, etc.).  But in any case, setting up
> suitable environment variables, aliases, etc., in a section of setup
> scripts that tests uname seems to be the agreed advice, along with
> specifics concerning cygpath and settings for particular programs ...

Something else the OP may be able to use is Luc Hermitte's
cyg-wrapper.sh script.  It's designed to solve exactly this problem
of running a Windows program from a Cygwin environment.

    http://hermitte.free.fr/cygwin/

Regards,
Gary


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

  reply	other threads:[~2011-08-08 22:17 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29 19:15 Sebastien Vauban
2011-07-29 19:45 ` Larry Hall (Cygwin)
2011-08-01  6:40   ` Sebastien Vauban
2011-07-29 19:47 ` Eliot Moss
2011-08-01  6:45   ` Sebastien Vauban
2011-07-29 20:17 ` Corinna Vinschen
2011-07-30 12:20   ` Andrey Repin
2011-08-01  6:50     ` Sebastien Vauban
2011-08-01  7:28       ` Csaba Raduly
2011-08-02 11:58         ` Sebastien Vauban
2011-08-02 12:36           ` Sebastien Vauban
2011-08-05 16:05       ` Andrey Repin
2011-08-08  1:16     ` Sven Köhler
2011-08-08  2:07       ` Eliot Moss
2011-08-08 22:17         ` Gary Johnson [this message]
2011-08-08  8:20       ` Andrey Repin
2011-08-08  9:11         ` Sven Köhler
2011-08-08 14:27           ` Eliot Moss
2011-08-01  7:00   ` Sebastien Vauban
2011-08-01  7:44     ` Corinna Vinschen
2011-08-02 12:11       ` Sebastien Vauban
2011-08-02 12:23       ` Sebastien Vauban
2011-08-02 14:37         ` Corinna Vinschen
2011-08-01  9:21     ` Thorsten Kampe
2011-08-02 12:25       ` Sebastien Vauban
2011-08-02 15:41         ` Eliot Moss
2011-08-02 20:05           ` Thorsten Kampe
2011-08-02 20:45             ` Christopher Faylor
2011-08-03 16:23             ` Andy Hall
2011-08-08  1:20         ` Sven Köhler
2011-08-08 13:41           ` Eric Blake
2011-08-10 12:03             ` Sven Köhler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110808222108.GA1184@KCJs-Computer \
    --to=garyjohn@spocom.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).