The following table displays features that are different among the three shells.
bash
ksh
tcsh
Meaning/action
$
%
Prompt.
>|
>!
Force redirection.
>>!
Force append.
> file 2>&1
>& file
Combine stdout and stderr.
' '
Substitute output of enclosed command.
$( )
Substitute output of enclosed command. (Preferred form.)
$HOME
$home
Home directory.
var=value
set var=value
Variable assignment.
export var=val
setenv var val
Set environment variable.
${nn}
More than nine args can be referenced.
"$@"
All args as separate words.
$#
$#argv
Number of arguments.
$?
$status
Exit status.
$!
Last background Process ID.
$-
Current options.
.file
source file
Read commands in file.
alias x=y
alias x y
Name x stands for y.
case
switch/case
Choose alternatives.
cd ~-
popd/pushd
Switch directories.
done
end
End a loop statement.
esac
endsw
End case or switch.
exit [n]
exit [(expr)]
Exit with a status.
for/do
foreach
Loop through values.
echo -E
print -r
glob
Ignore echo escapes.
hash
alias -t
hashstat
Display hashed commands (tracked aliases).
hash cmds
alias -t cmds
rehash
Remember command locations.
hash -r
PATH=$PATH
unhash
Forget command locations.
history
List previous commands.
fc -s
r
!!
Redo previous command.
fc -s str
r str
!str
Redo command that starts with str.
fc -s x=y [cmd]
r x=y [cmd]
!cmd:s/x/y/
Edit command, then execute.
if ((i==5))
if ($i==5)
Sample if statement.
fi
endif
End if statement.
ulimit
limit
Set resource limits.
pwd
dirs
Print working directory.
read
$<
Read from standard input.
trap INTR
TRap INTR
onintr
Ignore interrupts.
unalias
Remove aliases.
until/do
Begin until loop.
while/do
while
Begin while loop.