delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/06/02/20:46:29

From: dumser AT ti DOT com (James Dumser)
Subject: Re: [b18] Bash does not expand ~ and $HOME the same
2 Jun 1997 20:46:29 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <199706021444.JAA23078.cygnus.gnu-win32@lesol1.dseg.ti.com>
Mime-Version: 1.0
Original-To: franl AT world DOT std DOT com (Francis Litterio)
Original-Cc: gnu-win32 AT cygnus DOT com
In-Reply-To: <199705312355.AA10752@world.std.com> 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: owner-gnu-win32 AT cygnus DOT com

On Sat, 31 May 1997 19:55:38 -0400, franl AT world DOT std DOT 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 AT ti DOT com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019