TCSH SHELL COMMANDS


The shell is your interface to the operating system.
It acts as a command interpreter;
It takes each command and passes it to the operating system. It then displays the results of this operation on your screen.

The most common shells are :

To know which shell you have, type in a terminal : echo $shell
then you read for exemple : /bin/tcsh


VARIABLES (csh)

Commands used to declare and manipulate shell variables:

set - assigns non-numeric string variables locally
unset - removes a previously "set" variable

setenv - assigns non-numeric string variablesglobally
unsetenv - removes a previously setenv variable

@ - assigns numeric variables locally
echo $variable - displays value of variable



INITIALIZATION FILES :

As a login shell tcsh executes the following files in this order:

    /etc/csh.cshrc
    /etc/csh.login
    ~/.tcshrc
    ~/.cshrc (if .tcshrc is not found)
    ~/.history
    ~/.login
    ~/.cshdirs

tcsh can be compiled to execute login scripts before cshrc scripts. Beware!


WHAT SHOULD BE IN THE .TCSHRC FILE ?

starts with #!/bin/sh

list of setenv="environment value"

ex : setenv TERM vt100
list of set variable="variable value"
ex : set history=10
list of aliases
ex : alias h 'history -r |more'
limit coredumpsize 0

set path=($path /usr/local/bin . $HOME $HOME/bin)

# Our favourite editor
setenv EDITOR emacs

list of sources

source filename

How to declare PATH ?

PATH is a list of directories separated by colons (':') where commands are looked for.
These directories are searched through to find commands.
If you try to invoke command 'foo', all the directories in PATH (in that order : the first command found is executed) are searched for an executable file 'foo' (one with x-bit on). If a file is found, it is executed.

Example :
My personal path. Add my bin first, then add /usr/new/bin, then include the default path, then add /usr/old/bin at the end. This setup gives
preference to new software.

In Csh/Tcsh shell edit the .cshrc or .tcshrc file and add:
    set path = ( ~/bin /usr/new/bin $path /usr/old/bin )
 


WHAT IS THE .LOGIN FILE ?

runs at invocation of login shell, after the .cshrc file
typically sets terminal characteristics and one time shell options and environment variables



WHAT SHOULD BE IN THE .LOGIN FILE ?

list of setenv="environment value"

ex : setenv TERM vt100
## set DISPLAY environment variable
if (-e ~/.lastlogin) then
setenv DISPLAY `cat ~/.lastlogin`
endif

BUT : Never put any alias it it !



LINKS :

The SHELL
http://www.mhpcc.edu/training/vitecbids/UnixIntro/Shell.html

The .tcshrc project creates a set of configuration scripts for the TCSH shell. These scripts exploit the most advanced features of tcsh.
http://tcshrc.sourceforge.net/

PATH HOWTO
http://www.ibiblio.org/pub/Linux/docs/HOWTO/mini/other-formats/html_single/Path.html

Search Path Essentials NO NAME NEWSLETTER -- September 1996
http://www.ecn.purdue.edu/ECN/Newsletters/1996.September/Search_Path_Essentials



feel free to give feedback

chelghaf at yahoo.fr or at hotmail.com