BASH | TCSH | Output generation | BASH output |
TCSH output |
Comments | |
---|---|---|---|---|---|---|
Shell variables | x=3 |
set x=3 |
echo $x |
3 |
3 |
with 'set ', spaces are not important! |
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 |
Tcsh: why not 'setenv z = 5 ' ?! |
export q="$z 6" |
setenv q "$z 6" |
echo $q |
5 6 |
5 6 |
||
Shell &
environment variables |
z=7 |
set z = 7 |
echo $z; |
7 |
7 |
Tcsh: different shell and environment variables can have same name! |
PATH &
path variables |
export PATH=/a:/b |
set path=(/a /b) |
echo $path; |
- |
/a /b |
Tcsh: why is there a 'path ' shell variable? |
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) | Bash: file descriptors can be used! |
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! |
* Feb.2015