Book HomeLinux in a NutshellSearch this book

6.4. Differing Features

The following table is a sampling of features that are different among the three shells:

Meaning/Action bash csh tcsh
Default prompt.

$

%

%

Force redirection. >| >! >!
Force append. >>! >>!
Variable assignment. var=val set var=val set var=val
Set environment variable. export var=val setenv var val setenv var val
Number of arguments. $# $#argv $#argv
Exit status. $? $status $?
Execute commands in file. . file source file source file
End a loop statement. done end end
End case or switch. esac endsw endsw

Loop through variables.

for/do foreach foreach
Sample if statement. if [ $i -eq 5 ] if ($i==5) if ($i==5)
End if statement. fi endif endif
Set resource limits. ulimit limit limit
Read from terminal. read $< $<
Make a variable read-only. readonly set -r

File inquiry operator; tests for nonzero size.

-s
Complete current word. Tab Tab
Ignore interrupts. trap 2 onintr onintr
Begin until loop. until/do until until
Begin while loop. while/do while while



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.