This is the mail archive of the
mailing list for the Cygwin project.
Re: Problem with aliases in bash as login shell
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
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* "
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 <email@example.com>
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html