UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 3.4 Common FeaturesChapter 3
The UNIX Shell: An Overview
Next: 4. The Bourne Shell and Korn Shell
 

3.5 Differing Features

The table below is a sampling of 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.
$HOME$HOME $home Home directory.
~~Home directory symbol.
var=valuevar=valueset var=valueVariable assignment.
export varexport var=valsetenv var valSet environment variable.
${nn}More than 9 args can be referenced.
"$@""$@"All args as separate words.
$#$#$#argvNumber of arguments.
$?$?$statusExit status.
$!$!Background exit status.
$-$-Current options.
.  file.   filesource fileRead commands in file.
alias x=yalias x yName x stands for y.
casecaseswitch/caseChoose alternatives.
cd ~-popd/pushdSwitch directories.
donedoneendEnd a loop statement.
esacesacendswEnd case or switch.
exit [n]exit [n]exit [(expr)]Exit with a status.
for/dofor/doforeachLoop through variables.
print -rglobIgnore echo escapes.
hashalias -thashstatDisplay hashed commands (tracked aliases).
hash cmdsalias -t cmdsrehashRemember command locations.
hash -runhashForget command locations.
historyhistoryList previous commands.
r!!Redo previous command.
r str!strRedo command that starts with str.
r x=y cmd !cmd:s/x/y/Edit command, then execute.
if [ $i -eq 5 ]if ((i==5))if ($i==5)Sample if statement.
fifiendifEnd if statement.
ulimitulimitlimitSet resource limits.
pwdpwddirsPrint working directory.
readread$<Read from terminal.
trap 2trap 2onintrIgnore interrupts.
unaliasunaliasRemove aliases.
untiluntilBegin until loop.
while/dowhile/dowhileBegin while loop.


Previous: 3.4 Common FeaturesUNIX in a Nutshell: System V EditionNext: 4. The Bourne Shell and Korn Shell
3.4 Common FeaturesBook Index4. The Bourne Shell and Korn Shell

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System