Solved

Sample .login and .cshrc for tcsh

Posted on 1998-03-30
2
1,577 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

746 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

11 Experts available now in Live!

Get 1:1 Help Now