home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Book HomeBook TitleSearch this book

3.5. Differing Features

The following table displays features that are different among the three shells.

shkshcshMeaning/Action
$$%Prompt.
 >|>!Force redirection.
  >>!Force append.
> file 2>&1> file 2>&1>& fileCombine stdout and stderr.
  { }Expand elements in list.
‘ ‘‘ ‘‘ ‘

Substitute output of enclosed command.

 $( ) 

Substitute output of enclosed command. (Preferred form.)

$HOME$HOME$homeHome directory.
 ~~Home directory symbol.
var=valuevar=valueset var=valueVariable assignment.
export varexport var=valsetenv 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.

$!$! 

Background exit status.

$-$- 

Current options.

.  file.  filesource file

Read commands in file.

 alias x=yalias x y

Name x stands for y.

casecaseswitch/case

Choose alternatives.

 cd ~-popd/pushd

Switch directories.

donedoneend

End a loop statement.

esacesacendsw

End case or switch.

exit [n]exit [n]exit [(expr)]

Exit with a status.

for/dofor/doforeach

Loop through variables.

 print -rglob

Ignore echo escapes.

hashalias -thashstat

Display hashed commands (tracked aliases).

hash cmdsalias -t cmdsrehash

Remember command locations.

hash -rPATH=$PATHunhash

Forget command locations.

 historyhistory

List previous commands.

 r!!

Redo previous command.

 r str!str

Redo command that starts with str.

 r x=cmd!cmd:s/x/y

Edit command, then execute.

if [ $i -eq 5 ]if ((i==5))if ($i==5)

Sample if statement.

fifiendif

End if statement.

ulimitulimitlimit

Set resource limits.

pwdpwddirs

Print working directory.

readread$<

Read from standard input.

trap 2trap 2onintr

Ignore interrupts.

 unaliasunalias

Remove aliases.

until/dountil/do 

Begin until loop.

while/dowhile/dowhile

Begin while loop.



Library Navigation Links

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