Subject: Re: [b18] Bash does not expand ~ and $HOME the same
From: [email-masked] (James Dumser)

2 Jun 1997 20:46:29 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Original-To: [email-masked] (Francis Litterio)
Original-Cc: [email-masked]
In-Reply-To: <[email-masked]> from "Francis Litterio" at May 31, 97 07:55:38 pm
X-MIMI-Options: headers none
X-Mailer: ELM [version 2.4 PL23]
Original-Sender: [email-masked]

On Sat, 31 May 1997 19:55:38 -0400, [email-masked] (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 [email-masked]
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".