www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/11/21/10:53:09

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Message-ID: <f60fe000811210752v4ce7e159h8ecc2a217d548427@mail.gmail.com>
Date: Fri, 21 Nov 2008 10:52:19 -0500
From: "Mark J. Reed" <markjreed AT gmail DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Problem with aliases in bash as login shell
In-Reply-To: <b583b1500811210724p35027478u9e0a3bd4a4a1af55@mail.gmail.com>
MIME-Version: 1.0
References: <b583b1500811210637xaf79e08xb3d73ec67c5d79d5 AT mail DOT gmail DOT com> <574BF80562AF37419EA4B003C90D756D06E28550 AT EXCHANGE1 DOT belgium DOT fhm DOT de> <b583b1500811210710x41456cd3q1d8f264003d9d466 AT mail DOT gmail DOT com> <20081121151308 DOT GA23561 AT ednor DOT casa DOT cgf DOT cx> <b583b1500811210724p35027478u9e0a3bd4a4a1af55 AT mail DOT gmail DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Fri, Nov 21, 2008 at 10:24 AM, Ryan Stewart wrote:
> A nearly 4900 line man page is not exactly "direct". That was the
> first place I looked. It was also the last place I looked, but even
> knowing more or less what I was looking for, I couldn't find it. Can
> you point me to a line number in the man page?

To be fair, you have to do a lot of reading to learn the necessary
concepts; there's not really a simple statement you can search for.
Start with the section "COMMAND EXECUTION ENVIRONMENT", which is at
line 1665 on my system (but I'm not using Cygwin ATM).

"The shell has an execution environment, which consists of
[...]
shell aliases defined with alias
[...]
When a simple command other than a builtin or shell function is
executed, it is invoked in a separate execution environment
[...]
A command invoked in this separate environment cannot affect the
shell's execution envrionment".

So basically, any command you run gets its own copy of the shell
environment and can't change anything.  Environment variables,
aliases, current working dir, etc.  There is no way to have the DOS
effect of running a batch file and finding your command prompt in a
different directory at the end of it (a nasty surprise for someone
coming the other way from UNIX to DOS for the first time!)  You can
run .bash_profile all you want, but every time you're starting a new
copy of the shell that gets thrown away when it hits the end of the
file.

So far, it sounds like you're out of luck, but the other piece of info
is in the description of the "source" built-in
(line 2681 for me):

 "source filename [arguments]
              Read and execute commands from filename *in the current
shell environment* "

(emphasis mine).

Now, the "." command is a synonym for "source" - it's what the
"source" command was called in the original UNIX shell, probably
because it was most often used with files whose names start with ".".
It's the more common way to load a file into the current envionment,
but source is probably the easier command to find in the doc and would
have worked as well.








-- 
Mark J. Reed <markjreed AT gmail DOT com>

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

- Raw text -


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