This is the mail archive of the cygwin@sourceware.cygnus.com 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]

Re: [b18] Bash does not expand ~ and $HOME the same


On Sat, 31 May 1997 19:55:38 -0400, franl@world.std.com (Francis
  Litterio) wrote:
>I just noticed this bash oddity (with c:/ mounted as /):
>
>	bash$ echo $HOME
>	/franl
>	bash $ echo ~
>	c:/franl
>
>Isn't ~ supposed to expand to the current value of the variable HOME?

Not positive on the "correct" interpretation of ~ in bash; but in
cygwin's bash, ~ is only defined on startup -- changing HOME after that
will not change the value of ~. In fact, to get it right, you'll need to
set HOME the way you want it before starting bash. I do this with an
icon and a batch file:
- icon runs "c:\bin\shlogin.cmd /home/dumser"
- shlogin.cmd contains
    @echo off

    set HOME=%1
    if     "%2"=="" c:\bin\sh -login
    if not "%2"=="" c:\bin\sh -login -c "%2 %3 %4 %5 %6 %7 %8 %9"

(I tried using %* [CMD's equivalent of $*] after shifting %1 off the
stack but that didn't work -- the first argument did not get dropped off
%*. Does anyone know of a way to do this without having to manually
expand %2 %3 ...?)

Of course, Win95's COMMAND.COM is less featured than even CMD so you'll
probably need to use the brute force method above.

-- 
James Dumser    972-462-5335 dumser@ti.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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