Re: Portable shell code between Cygwin and Linux

2011-08-10 Thread Sven Köhler
Am 08.08.2011 15:40, schrieb Eric Blake: On 08/07/2011 07:20 PM, Sven Köhler wrote: pathconvert() { echo $1 } (There's one issue here: I would like to write echo -- $1, but echo doesn't understand --. Bummer.) echo _cannot_ be used to portably echo arbitrary strings. For that, you

Re: Portable shell code between Cygwin and Linux

2011-08-08 Thread Andrey Repin
Greetings, Sven Köhler! 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. You DON'T feed a

Re: Portable shell code between Cygwin and Linux

2011-08-08 Thread Sven Köhler
Am 08.08.2011 10:14, schrieb Andrey Repin: Greetings, Sven Köhler! 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

Re: Portable shell code between Cygwin and Linux

2011-08-08 Thread Eric Blake
On 08/07/2011 07:20 PM, Sven Köhler wrote: pathconvert() { echo $1 } (There's one issue here: I would like to write echo -- $1, but echo doesn't understand --. Bummer.) echo _cannot_ be used to portably echo arbitrary strings. For that, you need printf: pathconvert() { printf

Re: Portable shell code between Cygwin and Linux

2011-08-08 Thread Eliot Moss
On 8/8/2011 5:11 AM, Sven Köhler wrote: Am 08.08.2011 10:14, schrieb Andrey Repin: Greetings, Sven Köhler! 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

Re: Portable shell code between Cygwin and Linux

2011-08-08 Thread Gary Johnson
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

Re: Portable shell code between Cygwin and Linux

2011-08-07 Thread Sven Köhler
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

Re: Portable shell code between Cygwin and Linux

2011-08-07 Thread Sven Köhler
Am 02.08.2011 14:24, schrieb Sebastien Vauban: I don't like copy/pasting things, and just changing bits of the code, if I can avoid it. if you detect cygwin: pathconvert() { // do cygwin specific path conversion of $1 } if you don't detect cygwin pathconvert() { echo $1 } Use the

Re: Portable shell code between Cygwin and Linux

2011-08-07 Thread Eliot Moss
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:

Re: Portable shell code between Cygwin and Linux

2011-08-05 Thread Andrey Repin
Greetings, Sebastien Vauban! Must be alias vpnup='exec sudo openvpn --config $HOME/config/client.vpn --writepid /tmp/openvpn.pid ' that's where his problem began, IMO. That's interesting. I thought this was completely equivalent (~ or $HOME), and preferred the shorter version. For

RE: Portable shell code between Cygwin and Linux

2011-08-03 Thread Andy Hall
* Eliot Moss (Tue, 02 Aug 2011 11:40:44 -0400) On 8/2/2011 8:24 AM, Sebastien Vauban wrote: Thorsten Kampe wrote: * Sebastien Vauban (Mon, 01 Aug 2011 08:46:52 +0200) My goal is to have just 1 alias that would work both under Win32 (Cygwin) and Ubuntu Why don't have simply put

Re: Portable shell code between Cygwin and Linux

2011-08-02 Thread Sebastien Vauban
Hi Csaba, Csaba Raduly wrote: On Mon, Aug 1, 2011 at 8:49 AM, Sebastien Vauban  wrote: Andrey Repin wrote: 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.

Re: Portable shell code between Cygwin and Linux

2011-08-02 Thread Sebastien Vauban
Hi Corinna, Corinna Vinschen wrote: On Aug 1 08:46, Sebastien Vauban wrote: Corinna Vinschen wrote: 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

Re: Portable shell code between Cygwin and Linux

2011-08-02 Thread Sebastien Vauban
Hi Corinna Vinschen, Corinna Vinschen wrote: How is that different from using a drive letter like C:? The best you can do is to create a mount point(*) under Cygwin which has the same path as under Ubuntu. Then, just use the same POSIX paths on both systems. As I put all my files starting at

Re: Portable shell code between Cygwin and Linux

2011-08-02 Thread Sebastien Vauban
Hi Thorsten, Thorsten Kampe wrote: * Sebastien Vauban (Mon, 01 Aug 2011 08:46:52 +0200) My goal is to have just 1 alias that would work both under Win32 (Cygwin) and Ubuntu Why don't have simply put your alias definitions in if [[ $OSTYPE = cygwin ]]; then else? Because I really want one

Re: Portable shell code between Cygwin and Linux

2011-08-02 Thread Sebastien Vauban
Hi Csaba, Sebastien Vauban wrote: Csaba Raduly wrote: On Mon, Aug 1, 2011 at 8:49 AM, Sebastien Vauban  wrote: Andrey Repin wrote: 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

Re: Portable shell code between Cygwin and Linux

2011-08-02 Thread Corinna Vinschen
On Aug 2 14:22, Sebastien Vauban wrote: Hi Corinna Vinschen, Corinna Vinschen wrote: How is that different from using a drive letter like C:? The best you can do is to create a mount point(*) under Cygwin which has the same path as under Ubuntu. Then, just use the same POSIX paths on

Re: Portable shell code between Cygwin and Linux

2011-08-02 Thread Eliot Moss
On 8/2/2011 8:24 AM, Sebastien Vauban wrote: Hi Thorsten, Thorsten Kampe wrote: * Sebastien Vauban (Mon, 01 Aug 2011 08:46:52 +0200) My goal is to have just 1 alias that would work both under Win32 (Cygwin) and Ubuntu Why don't have simply put your alias definitions in if [[ $OSTYPE =

Re: Portable shell code between Cygwin and Linux

2011-08-02 Thread Thorsten Kampe
* Eliot Moss (Tue, 02 Aug 2011 11:40:44 -0400) On 8/2/2011 8:24 AM, Sebastien Vauban wrote: Thorsten Kampe wrote: * Sebastien Vauban (Mon, 01 Aug 2011 08:46:52 +0200) My goal is to have just 1 alias that would work both under Win32 (Cygwin) and Ubuntu Why don't have simply put your

Re: Portable shell code between Cygwin and Linux

2011-08-02 Thread Christopher Faylor
On Tue, Aug 02, 2011 at 10:04:43PM +0200, Thorsten Kampe wrote: * Eliot Moss (Tue, 02 Aug 2011 11:40:44 -0400) On 8/2/2011 8:24 AM, Sebastien Vauban wrote: Thorsten Kampe wrote: * Sebastien Vauban (Mon, 01 Aug 2011 08:46:52 +0200) My goal is to have just 1 alias that would work both under

Re: Portable shell code between Cygwin and Linux

2011-08-01 Thread Sebastien Vauban
Hi Larry, Larry Hall Cygwin wrote: On 7/29/2011 9:42 AM, Sebastien Vauban wrote: Here, I cd first to my config file, as I removed full paths from client.vpn config file: snip I'm aware of cygpath, but still don't see clearly which are the best trade-off to be able to write portable shell

Re: Portable shell code between Cygwin and Linux

2011-08-01 Thread Sebastien Vauban
Hi Eliot, Eliot Moss wrote: Another way to be portable is to have per-system files to set up some environment variables and then uniform portable files that use them. You can do that same thing *within* a file by writing conditionals or a case on the result of uname. It's probably best to

Re: Portable shell code between Cygwin and Linux

2011-08-01 Thread Sebastien Vauban
Hi Andrey, Andrey Repin wrote: 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

Re: Portable shell code between Cygwin and Linux

2011-08-01 Thread Sebastien Vauban
Hi Corinna, Corinna Vinschen wrote: 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

Re: Portable shell code between Cygwin and Linux

2011-08-01 Thread Csaba Raduly
On Mon, Aug 1, 2011 at 8:49 AM, Sebastien Vauban  wrote: Hi Andrey, Andrey Repin wrote: 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

Re: Portable shell code between Cygwin and Linux

2011-08-01 Thread Corinna Vinschen
On Aug 1 08:46, Sebastien Vauban wrote: Hi Corinna, Corinna Vinschen wrote: 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

Re: Portable shell code between Cygwin and Linux

2011-08-01 Thread Thorsten Kampe
* Sebastien Vauban (Mon, 01 Aug 2011 08:46:52 +0200) My goal is to have just 1 alias that would work both under Win32 (Cygwin) and Ubuntu Why don't have simply put your alias definitions in if [[ $OSTYPE = cygwin ]]; then else? Thorsten -- Problem reports:

Re: Portable shell code between Cygwin and Linux

2011-07-30 Thread 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

Re: Portable shell code between Cygwin and Linux

2011-07-29 Thread Larry Hall (Cygwin)
On 7/29/2011 9:42 AM, Sebastien Vauban wrote: snip Here, I cd first to my config file, as I removed full paths from client.vpn config file: snip 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?

Re: Portable shell code between Cygwin and Linux

2011-07-29 Thread Eliot Moss
Another way to be portable is to have per-system files to set up some environment variables and then uniform portable files that use them. You can do that same thing *within* a file by writing conditionals or a case on the result of uname. It's probably best to segregate per-system stuff in a

Re: Portable shell code between Cygwin and Linux

2011-07-29 Thread Corinna Vinschen
On Jul 29 15:42, Sebastien Vauban wrote: 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