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; |
7 |
7 |
different shell and environment variables can have same name in Tcsh! |
PATH
& path variables |
export PATH=/a:/b |
set path=(/a /b) |
echo $path; |
- |
/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 |
/etc/csh.cshrc |
||||
Non-login
shell startup files (order of shell parsing) |
~/.bashrc |
/etc/csh.cshrc |
||||
Logout cleanup files | ~/.bash_logout |
/etc/csh.logout |
||||
Scripting | (Ba)sh scripts are everywhere and are considered better! |