Differing Features
The following table is a sampling of features that differ between the two shells:
|
bash |
tcsh |
Meaning/Action |
|---|---|---|
|
$ |
% |
Default prompt. |
|
>| |
>! |
Force redirection. |
|
>>! |
Force append. | |
|
var=val |
set var=val |
Variable assignment. |
|
export var=val |
setenv var val |
Set environment variable. |
|
$# |
$#argv |
Number of arguments. |
|
$( command ), `` |
`` |
Command substitution. |
|
|
source file |
Execute commands in file. |
|
done |
end |
End a loop statement. |
|
esac |
endsw |
End case or switch. |
|
for/do |
foreach |
Loop through variables. |
|
if [ $i -eq 5 ] |
if ($i= =5) |
Sample if statement. |
|
fi |
endif |
End if statement. |
|
ulimit |
limit |
Set resource limits. |
|
read |
$< |
Read from terminal. |
|
readonly |
set -r |
Make a variable read-only. |
|
Tab Tab |
Show possible completions. | |
|
trap 2 |
onintr |
Ignore interrupts. |
|
until/do |
until |
Begin until loop. |
|
while/do |
while |
Begin while loop. |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access