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.

. file, source file

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.

Get Linux in a Nutshell, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.