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]

Portable shell code between Cygwin and Linux


Hello,

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

Here, I cd first to my config file, as I removed full paths from client.vpn
config file:

    ,----
    | ## client.vpn --- client-side OpenVPN config file
    | 
    | # SSL/TLS parms.
    | ca ca.crt
    | cert fni.crt
    | key fni.key
    `----

instead of:

    ,----
    | ## client.vpn --- client-side OpenVPN config file
    | 
    | # SSL/TLS parms.
    | ca /home/sva/config/ca.crt
    | cert /home/sva/config/fni.crt
    | key /home/sva/config/fni.key
    `----

I'm aware of cygpath, but still don't see clearly which are the best trade-off
to be able to write portable shell code -- if possible. Any hint?

Best regards,
  Seb

-- 
Sebastien Vauban


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