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]

Re: Portable shell code between Cygwin and Linux

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/ &'
>>> that's where his problem began, IMO.
>> That's interesting. I thought this was completely equivalent (~ or $HOME),
>> and preferred the shorter version.
>> But you say it's not. Can you comment on this? ÂThanks in advance...
> bash.infoÂÂ Tilde expansion:
> "If a word begins with an unquoted tilde character (`~'), all of the
> characters up to the first unquoted slash (or all characters, if there
> is no unquoted slash) are considered a TILDE-PREFIX."
> Note "word begins". I've been bitten by this in a makefile:
> OPENSSL_DIR := ~/lib/openssl
> The gcc command line then contained -I~/lib/openssl, and the ~ was not
> expanded by the shell. ${HOME}/lib/openssl would have worked.

Excellent explanation. I was totally unaware of this.

> If you want the same alias to work on Cygwin and Linux, you should set
> up your $HOME on Cygwin to contain config/client.vpn
> You can set your home in /etc/passwd and point it to /cygdrive/c/home
> (this may have been mentioned already).
> The idea is to always refer to the VPN config as
> ${HOME}/config/client.vpn and ensure that Cygwin can access it that
> way.

I, maybe, have done it the completely wrong way(TM). As it currently is, I've
defined an environment variable in Windows itself:


I did not touch so far /etc/passwd. The only visible effect of this is that
when firing up a bash terminal, the default directory is set to:

    c:/Documents and Settings/Sebastien

OK, I will update my HOME directory in /etc/passwd. Thanks for the reminder.
Do I have, though, to define HOME in Windows, in Cygwin (.bashrc or such), or

Best regards,

Sebastien Vauban

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]