Solved

Sample .login and .cshrc for tcsh

Posted on 1998-03-30
2
1,579 Views
Last Modified: 2008-02-01
Hey all,
      I would like to know if there is a "general" or typical .login and .cshrc I can take and modify for use
on my school (system 5) unix account.  I am currently in a ksh., and want to upgrade to the tcsh.
                                                                                  thanks in advance,  
                                                                                  gs01web@panther.gsu.edu
                                                                                   Evan
0
Comment
Question by:evhead
2 Comments
 
LVL 10

Accepted Solution

by:
rbr earned 50 total points
ID: 2009054
1.) .login
# This is the default standard .login provided to csh users.
# They are expected to edit it to meet their own needs.
#
# The commands in this file are executed when a csh user first
# logs in.  This file is processed after .cshrc.
#
# $Revision: 1.8 $
#

# Set the interrupt character to Ctrl-c and do clean backspacing.
alias l ls -la
alias rm rm -i
alias del rm -i
alias alld "'rm'"
alias mail Mail
alias wipe "'rm' -r"

if (-t 0) then
    stty intr '^C' echoe
endif

# Set the TERM environment variable
eval `tset -s -Q`

# Set the default X server.
if ($?DISPLAY == 0) then
    if ($?REMOTEHOST) then
        setenv DISPLAY ${REMOTEHOST}:0
    else
        setenv DISPLAY :0
    endif
endif
umask 77
alld $home/.spooler/* > /dev/null
alld $home/tmp/* > /dev/null
alld $home/usr/* > /dev/null
alld -r .netscape/cache/*
alld .netscape-cache/*
setenv TERM vt100


2.) .cshrc
# This is the default standard .cshrc provided to csh users.
# They are expected to edit it to meet their own needs.
#
# The commands in this file are executed each time a new csh shell
# is started.
#
# $Revision: 1.6 $
#

# list directories in columns
alias ls 'ls -C'

# Remember last 100 commands
set history = 100

# For interactive shells, set the prompt to show the host name and event number.
if ( $?prompt ) then
        if ( -o /bin/su ) then
                set prompt="`hostname -s` \!# "
        else
                set prompt="`hostname -s` \!% "
        endif
endif
setenv PRINTER tp_b
setenv TMPDIR ~/tmp
set path = (/usr/etc $home/work/cmd $home/work/tsk $home/tools /usr/local/bin $path)
0
 
LVL 3

Expert Comment

by:braveheart
ID: 2009055
Hmm. I think that upgrading from the ksh to the tcsh is an oxymoron. However...

There is no such thing as typical initialisation files but maybe a few guiding principles will help you.

Remember that .cshrc is executed every time you start up a new C shell, whether that is by typing csh at the command line, logging in, or executing a csh command script. Of course you can avoid executing .cshrc in a script by starting it with:
#!/bin/csh -f
where -f means fast.

The .login file is executed once per login session at an interactive terminal, *after* .cshrc, which I always find illogical.

Environment variables are inherited from parent shells but aliases are not, so...

you should initialise terminal control characters, prompts, default file access and maybe some environment variables in your .login file but aliases should be initialised in .cshrc.

You might like to set your prompt so that it contains useful information such as the current directory, or history number, or username (if you use different ones), or hostname (if you use different ones).

Try "man csh" and "man tcsh" for more information.

If you are working in an X oriented environment, you may have a file that is executed once for every session and not per login. This may be called .xsession (or something similar) but this is not standardised between different flavours of UNIX. There are also lots of different ways of initialising X. .xinitrc is another one.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now