X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=1.2 required=5.0 tests=BAYES_00,DATE_IN_PAST_03_06,FROM_LOCAL_NOVOWEL,HK_RANDOM_FROM,RCVD_NUMERIC_HELO,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: "Sebastien Vauban" Subject: Portable shell code between Cygwin and Linux Date: Fri, 29 Jul 2011 15:42:33 +0200 Lines: 45 Message-ID: <80hb65b3ue.fsf@somewhere.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Url: Under construction... X-Archive: encrypt User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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