Results 1 to 6 of 6

Thread: OpenSUSE 11.3 "Teal" /bin/tcsh ignoring .login

  1. #1
    Join Date
    Jul 2010
    Location
    The Bay Area(tm)
    Posts
    3

    Default OpenSUSE 11.3 "Teal" /bin/tcsh ignoring .login

    I just installed 11.3 on a little laptop and I can't get tcsh to load my .login file.

    I set the machine to come up in "runlevel 3" -- Multi-User mode, console logins only

    I changed my shell to /bin/csh:
    Code:
    % chsh -s /bin/csh
    Password:
    Shell changed
    (/bin/csh is a link to tcsh)

    I added some lines to ~/.login:
    Code:
    echo "login IN"
    setenv X "asdf"
    setenv Y "qwer"
    echo "login OUT"
    and to .cshrc:
    Code:
    echo "cshrc IN"
    alias wert poiu
    alias gfsd xnms
    echo "cshrc OUT"
    There is no ~/.tchrc file.

    When I log in, all I see is:
    Code:
    cshrc IN
    None of the environment variables are set, and the all aliases are.

    The tcsh man page says pretty clearly both these files should be sourced on login, in this order:
    1. /etc/csh.cshrc
    2. /etc/csh.login
    3. ~/.tcshrc or ~/.cshrc
    4. ~/.history
    5. ~/.login
    6. ~/.cshdirs

    There is some mention in the man page about the order in which the ~/.login file is sourced, but the version of tcsh here is compiled to source the ~/.login file before the ~/.cshrc file:
    Code:
    % tcsh --version
    tcsh 6.17.00 (Astron) 2009-07-10 (i586-suse-linux) options wide,nls,lf,dl,al,kan,sm,color,filec
    The "lf" item there is the LOGINFIRST option, which indicates the ~/.login file should be sourced before the ~/.cshrc file, and would change the order listed above, which came from the man page.

    I checked "ps" as well, just to make sure I wasn't in some sub-process. My csh process has a "-" in front of it, which usually means that is a login process.

    If I switch back to /bin/sh (a link to bash) and put similar lines in my ~/.profile and ~/.bashrc, they work as expected:
    Code:
    bashrc IN
    bashrc OUT
    profile IN
    profile OUT
    So... have I covered all the bases? Is there anything else I should be looking at before I decide tcsh is broken?

    There is little substantial difference between bash and tcsh these days. Should I just give up on tcsh and switch to bash?

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: OpenSUSE 11.3 "Teal" /bin/tcsh ignoring .login

    What happens if you do:

    csh -l

    does it read ~/.login?

    I don't have 11.3 on this machine so I'm testing with 11.2 and csh -l reads ~/.login fine. In fact I discovered some settings in my ~/.login from about 13 years ago, when I last used csh on a Sun host.

  3. #3
    Join Date
    Jul 2010
    Location
    The Bay Area(tm)
    Posts
    3

    Default Re: OpenSUSE 11.3 "Teal" /bin/tcsh ignoring .login

    Yes:
    Code:
    cshrc IN
    cshrc OUT
    login IN
    login OUT

  4. #4
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: OpenSUSE 11.3 "Teal" /bin/tcsh ignoring .login

    Hmm, on 11.2, it worked for me. I changed a test user's shell to /bin/csh, put an echo line in .login and ssh user@localhost and it was printed out.

  5. #5
    Join Date
    Jul 2010
    Location
    The Bay Area(tm)
    Posts
    3

    Default Re: OpenSUSE 11.3 "Teal" /bin/tcsh ignoring .login

    I'm seeing this work correctly on an 11.2 system here we've not yet upgraded. (With tcsh version 6.15)

    I'm starting to think this is either a problem with how SUSE 11.3 is starting the tcsh login shell or a problem with tcsh (version 6.17) itself.

    Getting my aliases converted over to bash is turning into a pain. I'm leaning toward just putting all my stuff in ~/.cshrc (which is WRONG and irritates me) and just getting on with my life.

  6. #6
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: OpenSUSE 11.3 "Teal" /bin/tcsh ignoring .login

    Put something like this in .cshrc

    if is-login-shell
    source ~/.login
    endif

    I forgot what the test is for a login shell, but I'm sure a search will find it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •