> The comand, where I change to be a "different user", e.g.
> $ su - zsolt
> Where 'zsolt' is the user name.
>> "su" on its own will change your uid and nothing else, I believe.
>> Read the manpage for its behaviour with other options.
OPTIONS
- make this a login shell
So obviously it executes the scripts specified for root's shell when
run as a login shell. If root's shell is bash, then that is:
When bash is invoked as an interactive login shell, or as
a non-interactive shell with the --login option, it first
reads and executes commands from the file /etc/profile, if
that file exists. After reading that file, it looks for
~/.bash_profile, ~/.bash_login, and ~/.profile, in that
order, and reads and executes commands from the first one
that exists and is readable.
Note:
The current environment is passed to the new shell. The
value of $PATH is reset to /bin:/usr/bin for normal users,
or /sbin:/bin:/usr/sbin:/usr/bin for the super user ...
Quote:> 2. Right now, the bash functions that I defined in my .bashrc file are working from this shell, e.g.
> if I issue the command "makes" - it calls my bashrc function makes() which will do some preparations
> before calling the normal make command. However, if I start up xemacs from this terminal window or
> from the KDE menu, then inside xemacs, there is a 'compile command', i.e. a command which will be
> issued when you hit the 'compile' menu button - this invokes a shell to execute the given command.
> By default it is set to be 'make -k'. I have changed that to be 'makes -k', to invoke the bash
> function that I wrote (called makes) which does some additional stuff , e.g. changing directories.
> However, when I invoke the compile command in xemacs, it gives an error message, that it does
> not recognise the command 'makes'. So appearantly, the shell started by xemacs does not have the
> definition from my bashrc.
Indeed not, since it is not a login shell. Read the manpage for bash
for the other types of shell invoocations. I believe you
have a noninteractive nonlogin shell there ...
When bash is started non-interactively, to run a shell
script, for example, it looks for the variable BASH_ENV in
the environment, expands its value if it appears there,
and uses the expanded value as the name of a file to read
and execute. Bash behaves as if the following command
were executed:
if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
but the value of the PATH variable is not used to search
for the file name.
So presumably you want to set BASH_ENV to your functions script
file before calling emacs.
Quote:> Before I upgraded to Mandrake 8.0, I used Mandrake 7.2. With that system, my bash function worked
> OK directly from xemacs. Some default configuration must have changed for the 8.0 release, which
Read manpage for your new shell. Apparently it has changed. I don't
guarantee that I am using the same bash as you (and I don't use bash
anyway). In my version (2.03) of bash, no functions are exported
automatically to subshells, interactive or not. Obviously login
shells get the function defs anew.
Peter