[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: differences between telnet and terminal window



Wrong! Take a look at the default /root/.bash_profile and /root/.bashrc
- .bashrc explicitly says in the comments:

# User specific aliases and functions

.bash_profile is NOT sourced when a non login shell is initiated:

       When  bash is invoked as an interactive login shell, or as a
non-inter-
       active shell with the --login option, it first reads and executes
com-
       mands  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.  The --noprofile option may be  used
when  the
       shell is started to inhibit this behavior.

	 ...

       When an interactive shell that is not a login shell  is  started,
bash
       reads  and executes commands from ~/.bashrc, if that file exists.
This
       may be inhibited by using the --norc option.  The --rcfile file
option
       will  force  bash  to  read  and  execute commands from file
instead of
       ~/.bashrc.

       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 com-
       mand 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.

       ...

	       BASH_ENV
              If this parameter is set when bash is executing a shell
script,
              its  value  is  interpreted as a filename containing
commands to
              initialize the shell, as in ~/.bashrc.  The value of
BASH_ENV is
              subjected  to  parameter  expansion,  command
substitution, and
              arithmetic expansion before being interpreted as  a  file
name.
              PATH is not used to search for the resultant file name.

And, since neither ENV or BASH_ENV is set in /etc/profile (but IS set in
.bash_profile), by default the .bashrc file will not be sourced be a new
terminal session unless the window manager has ENV or BASH_ENV in its
environment - that depends on how the window manager is started.

Kevin

-----Original Message-----
From: taroon-list-bounces redhat com
[mailto:taroon-list-bounces redhat com] On Behalf Of Garrick Staples
Sent: Friday, September 03, 2004 10:09 AM
To: Discussion of Red Hat Enterprise Linux 3 (Taroon)
Subject: Re: differences between telnet and terminal window


On Fri, Sep 03, 2004 at 09:31:43AM -0700, Collins, Kevin (KCollins)
alleged:
> More than likely, the terminal window will be missing things like
> aliases that are evaluated in a "login", which happens with telnet.
Most
> X-terminal apps support a "-ls" (login shell) option that causes them
to
> source the whole environment as if a login were occurring. 

If that is happening, then the environment is arguable misconfigured.
Only
exportable items (environmental variables) should be configured on
login.  All
non-exportable items (function definitions, aliases, shell opts, etc),
should
be configred in your profile so that all new shells are configured
correctly.

When non-exportable items are in your login scripts, then subshells
can't pick
these up.



> -----Original Message-----
> From: taroon-list-bounces redhat com
> [mailto:taroon-list-bounces redhat com] On Behalf Of SATISH RAMANATHAN
> Sent: Friday, September 03, 2004 9:24 AM
> To: taroon-list redhat com
> Subject: differences between telnet and terminal window
> 
> 
> Hi,
> 
> This might be a silly question, but how are environments of
> * a telnet session i.e. a remote login session created by running
> "telnet 
> <machine-name>" and
> * a terminal window i.e. obtained by right clicking on the desktop
> console 
> and choosing "New Terminal"
> different?  Aren't they supposed to be similar?  I am looking at
> differences 
> in behavior of my application depending on which mode is used for
login.

-- 
Garrick Staples, Linux/HPCC Administrator
University of Southern California



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]