J. Magalhães Cruz

Some differences between BASH e TCSH

(or: Why I prefer BASH!)

Bash vs Tcsh: Table of Differences
BASH TCSH Output generation BASH
output
TCSH
output
Comments
Shell variables x=3 set x = 3 echo $x 3 3 spaces are not important in Tcsh!
y=$x:4 set y=($x 4) echo $y 3:4 3 4
Environment variables
(children inherit them)
export z=5 setenv z 5 echo $z 5 5 why not 'setenv z = 5' in Tcsh?!
export q=$z:6 setenv q "$z 6" echo $q 5:6 5 6 why not 'setenv q ($z 5)' in Tcsh?!
Shell & environment
variables
z=7 set z = 7 echo $z;
env|grep z
7
z=7
7
z=5
different shell and environment variables can have same name in Tcsh!
PATH & path
variables
export PATH=/a:/b set path=(/a /b) echo $path;
echo $PATH;
env|grep path
-
/a:/b
-
/a /b
/a:/b
-
why is there a 'path' shell variable in TCSH?
Aliases alias ls="ls -l" alias ls "ls -l" ls (same as ls -l) (same as ls -l)
Command prompt PS1=abc- set prompt=abc- [ENTER] abc- abc-
Redirection prog > ofile 2> efile (prog > ofile) >& efile [ENTER] (stdout data in ofile; stderr data in efile) (stdout data in ofile; stderr data in efile) file descriptors can be used with Bash!
Login shell startup files
(order of shell parsing)
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
/etc/csh.cshrc
/etc/csh.login
~/.tcshrc
~/.cshrc
~/.login
Non-login shell startup files
(order of shell parsing)
~/.bashrc /etc/csh.cshrc
~/.tcshrc
~/.cshrc
Logout cleanup files ~/.bash_logout /etc/csh.logout
~/.logout
Scripting (Ba)sh scripts are everywhere and are considered better!

References: