delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/06/30/17:12:30

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:message-id:from:to:cc:subject
:content-type:date:in-reply-to:references; q=dns; s=default; b=t
UBu2Xe3pDauQn/8RB3+dCTWTuq2wHhxPCbi1IU0m5CzaNFPllMxsuX3xXNTmAcxl
jD/SoRs6G/vY2cEJaraKe7KS5K+vYy1JIWBtL04P9l/RxpbhAYizJeq1/q6Tx1no
5Kv4s5Y6FkuvJ9p3NCttRxEa2DJCrdY867abj3j6ao=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:message-id:from:to:cc:subject
:content-type:date:in-reply-to:references; s=default; bh=JGHW243
3ywfOn4eVdRsrvJ708SI=; b=m6p6uVIC1XpIInghZYM2OdXGLV0f+L3DH2gUb4N
NC9LrDhRdlR0nW1wPI6SA4WJX4c5M/IftgdVjmpaZlMs7lDIcsECWwLKOHcOOF1l
s9HodHOKk6l67pZ7sRcn8xHQiz7ru6ivQRDI7YsWqVLnbKaz/WMy0x8yWiGT2nrr
Xoqs=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=Sourcing, login, Different, clicking
X-HELO: mout.gmx.net
MIME-Version: 1.0
Message-ID: <trinity-cf09c12c-aac7-4ed6-89b3-daf71a65257c-1467321118037@3capp-gmx-bs40>
From: "Rainer Blome" <rainer DOT blome AT gmx DOT de>
To: "Nellis, Kenneth" <Kenneth DOT Nellis AT xerox DOT com>
Cc: "cygwin AT cygwin DOT com" <cygwin AT cygwin DOT com>
Subject: RE: chere not seeing my preferred $HOME
Date: Thu, 30 Jun 2016 23:11:58 +0200
Sensitivity: Normal
In-Reply-To: <0D835E9B9CD07F40A48423F80D3B5A704BB77F14@USA7109MB022.na.xerox.net>
References: <trinity-63d84bf2-3537-4dc9-bd09-fd297e17bc5b-1467314772125 AT 3capp-gmx-bs40>, <0D835E9B9CD07F40A48423F80D3B5A704BB77F14 AT USA7109MB022 DOT na DOT xerox DOT net>
X-UI-Message-Type: mail
X-UI-Out-Filterresults: notjunk:1;V01:K0:cYDvhnPbKiI=:GrnrEv452+SqHk4/FDMr+B agznjSXYtY7XeUxCELAIsRsjgIFrFtwViE8YeEIOeKqKJztS1O+DByl1WZpQcMvGGkRXgeD3D h+BCLpVrPgUWiVWWcaum8NNMe9b1pv01QAAnXcbzahAeUMfOQe6bWEdVxaIooY5L58BR/IFsL sTPv8TqjN4RSvSLKML0IDcUUCTbZzHnI3mpo4TQTckTPy4q3npDDJJOlQarAsUoHtYgPIxO9r 8fAz2+de716osCKkW0OMbimqOERZxezceATAdhA0SduIcASDTEiqWI+5/SZ+44XEOd/nTHv7j bnTMsOCWbIoQHJkBR7K+v3F/QFCfGoQYP8ZQ6UIOB2Rcjpw4lTCCykOEhAej/eR6LrjM9wbLF zkfvYBiYD99NgkfWXaLejF8KLjmiagUqT5oR/PJU3lw8gz7Y4f0mmM5jRReSUPo8f01ktyYh/ yciz8ttXYA==
X-IsSubscribed: yes

> Gesendet: Donnerstag, 30. Juni 2016 um 21:55 Uhr
> Von: "Nellis, Kenneth"
> Hello. http://www.cygwin.com/acronyms/#PCYMTNQREAIYR

Sorry, forgot, thanks for pointing it out.
  
> I simply want chere to run my .profile before it presents
> me with the bash prompt.

How to achieve that depends on your shell.
For example, .bash_profile is not read for every bash instance.
See section INVOCATION of `man bash`, where details are
given which file is read when (or not).
My solution is to conditionally read `.profile` from the shell-specific
`.XYZshrc` file. See a part of my `.bashrc` below, as an appendix.

> I guess the problem is knowing how to tell chere what
> my Cygwin $HOME is.

My understanding is that for the same cygwin user,
$HOME should always have the same value,
regardless of where you used "Bash Prompt Here".
Clicking that in C:\cygwin\etc yields a shell that behaves
like this for me:

/etc> echo $HOME
/cygdrive/c/blome # That's what I have configured.

> Using the word "domain" generically, there is my Windows
> domain ($HOME is C:\Users\KNellis) and my Cygwin domain
> ($HOME is C:\cygwin\home\knellis).

I think I still don't understand what you mean by domain.

> > > Hoping I can keep the two domains separate.

And I'm not sure what you mean by "keep separate".
The paths you gave above are directories, which are obviously
(hopefully ;-) already separate.

Under Cygwin, in a shell, $HOME should have a value with slashes,
`/home/knellis` in your case, true?

In a windows terminal ("Command Prompt"), `$HOME` does not
refer to an environment variable (those would use `%XYZ%`).
For me, the environment variable named HOME is not set.
`echo %HOME%` yields literally `echo %HOME%`.
Looking through the output of `set`, there are two variables
that contain my windows user's home directory, HOMEPATH
(without the drive letter) and USERPROFILE.

> chere appears to be using my Windows domain,

That would be surprising indeed.

> which doesn't have a .bash_profile,
> but I'd like it to use my Cygwin domain.

> > > chere> echo $HOME; cygpath -w $HOME
> > > /cygdrive/c/Users/KNellis
> > > C:\Users\KNellis

What does "chere" mean here?
How exactly did you get this shell?
Which commands did you type, what did you click?

Repeat: 
> > How come you have differing values for $HOME in some contexts?
> Different domains.
In the context of my above questions, can you give a more precise answer?

Rainer 


----
# Regarding initialization files, Bash knows 3 different shells:
# o A "normal", non-interactive shell, such as in "bash -c 'echo Hello'",
#   does not load any file.
# o An interactive shell, one that reads commands from a terminal, is
#   supposed to read "~/.bashrc".
# o A login shell is supposed to read "~/.profile".

# When an interactive login shell is started, Bash loads the .bashrc
# first, then the .profile.

# --------------------------------------------------------------------
#debug="true";
note() { echo 1>&2 "$@"; }
c() { if [ ! "" = "${debug-}" ]; then note "$*"; fi; }

# Reentrance handling

if [ ! "" = "${home_bashrc_was_read-}" ]; then
    c ".bashrc: Warning, .bashrc reentered (possible recursion).";

    # FIXME: Simply continuing would make it easier to reload this file.

    if [ "" = "${debug-}" ]; then
	c ".bashrc stopped.";
	return 0;
    else
	c "Continuing .bashrc (because we are in debug mode).";
    fi;
fi;

# Keep this here, don't move it to the end of the file.
# We just want to know whether it was tried to read
# this, not whether it was successful.
home_bashrc_was_read="true";		# Do not export this!

c .bashrc running...

# --------------------------------------------------------------------
# FIXME: This assumes that the $HOME value is valid, which it may not
# be.  For example, on Windows, $HOME may be "C:/" instead of anything
# actually user-specific.

if [ "" = "${HOME_PROFILE_WAS_READ-}" ]; then
    c ".bashrc: Sourcing '.profile'...";
    . "$HOME/.profile";
    c ".bashrc: Sourced '.profile'.";
fi;
----

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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