Question about .login and .cshrc

Question about .login and .cshrc

Post by guno » Tue, 28 Dec 1999 04:00:00



I usually connet to SunOS host in my school via telnet.

Nowadays, I'm trying to use jdk in that machine.

To redirect the display to my computer's X-window in my home

, I inserted the command,

setenv DISPLAY myip:0.0

in .cshrc file( currently, I'm using C-shell).

(eg:'myip' is my ip address).

However, when I invoke 'appletviewer' , it tries to connet to

the local machine's X server in my school.

so, I typed 'setenv' command. The result is

...
DISPLAY=localmachine:0.0
...

(eg:'localmachine' is the name of machine in my school).

I coulnd't know why the environment vailable wasn't changed.

Later I found that

setenv DISPLAY localmachine:0.0

command is in my '.login' file.

I removed the line from .login file then invoked

'appletviwer'and then, everything was ok.

Appletviewer appeared on my screen .

I'm sorry to tell you so far the behind story of my question.

my question is

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The contents in .login file override the contents in .cshrc file ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and I eager to know about the precedence.

login -> invoking shell -> load & exec .login script

-> load & exec .cshrc script

Is it right ?

 
 
 

Question about .login and .cshrc

Post by guno » Wed, 29 Dec 1999 04:00:00


I usually connet to SunOS host in my school via telnet.

Nowadays, I'm trying to use jdk in that machine.

To redirect the display to my computer's X-window in my home

, I inserted the command,

setenv DISPLAY myip:0.0

in .cshrc file( currently, I'm using C-shell).

(eg:'myip' is my ip address).

However, when I invoke 'appletviewer' , it tries to connet to

the local machine's X server in my school.

so, I typed 'setenv' command. The result is

...
DISPLAY=localmachine:0.0
...

(eg:'localmachine' is the name of machine in my school).

I coulnd't know why the environment vailable wasn't changed.

Later I found that

setenv DISPLAY localmachine:0.0

command is in my '.login' file.

I removed the line from .login file then invoked

'appletviwer'and then, everything was ok.

Appletviewer appeared on my screen .

I'm sorry to tell you so far the behind story of my question.

my question is

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The contents in .login file override the contents in .cshrc file ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and I eager to know about the precedence.

login -> invoking shell -> load & exec .login script

-> load & exec .cshrc script

Is it right ?

 
 
 

Question about .login and .cshrc

Post by LC's No-Spam Newsreading accoun » Wed, 29 Dec 1999 04:00:00



> my question is
> The contents in .login file override the contents in .cshrc file ?
> and I eager to know about the precedence.

> login -> invoking shell -> load & exec .login script
> -> load & exec .cshrc script

> Is it right ?

NO.
Although that would seem logical the order is instead :

   any shell sources .cshrc  THEN ONLY if login shell sources .login

(BTW, it's "sourced" in the same process, not exec'ed in a subprocess !)
And note that not all shells need to be flagged as login shells.

If .login contains only environment setting, that is inherited by subshells
so there is no need to source .login again.

--
----------------------------------------------------------------------

avoid unwanted spam. Any mail returning to this address will be rejected.
Users can disclose their e-mail address in the article if they wish so.

 
 
 

Question about .login and .cshrc

Post by Harald Kirsc » Wed, 29 Dec 1999 04:00:00



> , I inserted the command,

> setenv DISPLAY myip:0.0

> in .cshrc file( currently, I'm using C-shell).

[snip[
> Later I found that

> setenv DISPLAY localmachine:0.0

> command is in my '.login' file.

man tcsh says:

       A login shell begins by executing commands from the system
       files /etc/csh.cshrc and /etc/csh.login.  It then executes
       commands  from  files  in the user's home directory: first
       ~/.tcshrc (+) or, if ~/.tcshrc  is  not  found,  ~/.cshrc,
       then  ~/.history (or the value of the histfile shell vari-
       able), then ~/.login, and finally ~/.cshdirs (or the value
       of  the  dirsfile shell variable) (+).  The shell may read
       /etc/csh.login before instead of after /etc/csh.cshrc, and
       ~/.login before instead of after ~/.tcshrc or ~/.cshrc and
       ~/.history, if so compiled; see the  version  shell  vari-
       able. (+)

The `usual' order is for login-shells (typically telnet-sessions):

  /etc/csh.cshrc
  /etc/csh.login
  /etc/.cshrc
  /etc/.login

It is easy to remember if you remember that it is just different from
what you think it should be :-)

Harald Kirsch
P.S.: Could you stop posting messages with every second line being
empty? It is a pain to read. I wonder why you do that?

--
---------------------+---------------------------------------------


 
 
 

Question about .login and .cshrc

Post by Barry Margoli » Wed, 29 Dec 1999 04:00:00




>Hmm, not according to the manpage for csh.  .login before .cshrc. Why
>tcsh would act different is beyond me.  Then again, why would anyone
>use any *csh is also beyond me.

My Solaris 2.6 man page says .cshrc before .login, which is how it's been
for as long as I can remember it:

     If the shell is a login shell, this is the sequence of invo-
     cations:   First,  commands  in  /etc/.login  are  executed.
     Next, commands from the .cshrc file your home directory  are
     executed.   Then the shell executes commands from the .login
     file in your home directory; the same permission  checks  as
     those  for  .cshrc are applied to this file.

Maybe you misread /etc/.login as ~/.login (I made that mistake the first
time I looked at this paragraph).

--

GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

 
 
 

1. question about .cshrc amd .login

Can any body tell me what exactly should be there in .cshrc and .login

I think the question has asked before . sorry for repeting the question.

please send me an e-mail .

Thanks in advance.

Vedati
--

Krishna Vedati

Concurrent Engineering Research Center

2. Pointing to one page - newbe

3. Question about .login and .cshrc

4. GIS/NCR and 3B

5. Matrox Mystique ands X.

6. minimal X installation

7. funtion of .login vs .cshrc

8. FreeBSD Routing Hang - more info

9. .cshrc or .login

10. login/cshrc problem - 'no job control'

11. How do *you* separate .login and .cshrc?

12. .cshrc VS .login (what goes where?)

13. .login, .cshrc, .profile