.CD "sh \(en shell"
.SX "sh\fR [\fIfile\fR]"
.FL "\fR(none)"
.EY "sh < script" "Run a shell script"
.PP
.I Sh
is the shell.
It permits redirection of input and output, pipes, magic characters, 
background processes, shell scripts and most of the other features of 
the V7 (Bourne) shell.
A few of the more common commands are listed below:
.nf
.ta 2i 2.5i 3i 
.HS
.in +0.25i
date	# Regular command
sort <file	# Redirect \fIstdin\fR
sort <file1  >file2	# Redirect \fIstdin\fR and \fIstdout\fR
cc file.c  2>error	# Redirect \fIstderr\fR
a.out >f  2>&1	# Combine standard output and standard error
sort <file1  >>file2	# Append output to \fIfile2\fR
sort <file1  >file2 &	# Background job
(ls \(enl; a.out) &	# Run two background commands sequentially
sort <file | wc	# Two-process pipeline
sort <f | uniq | wc	# Three-process pipeline
ls \(enl *.c	# List all files ending in \fI.c\fR
ls \(enl [\fIa-c\fR]*	# List all files beginning with \fIa\fR, \fIb\fR, or \fIc\fR
ls \(enl ?	# List all one-character file names
ls \\?	# List the file whose name is question mark
ls \(fm???\(fm	# List the file whose name is three question marks
v=/usr/ast	# Set shell variable \fIv\fR
ls \(enl $v	# Use shell variable \fIv\fR
PS1=\(fmHi! \(fm	# Change the primary prompt to \fIHi!\fR
PS2=\(fmMore: \(fm	# Change the secondary prompt to \fIMore:\fR 
ls \(enl $HOME	# List the home directory
echo $PATH	# Echo the search path
if ... then ... else ... fi	# If statement
for ... do ... done	# Iterate over argument list
while ... do ... done	# Repeat while condition holds
case ... in ...  esac	# Select clause based on condition
echo $?	# Echo exit status of previous command
echo $$	# Echo shell's pid
echo $#	# Echo number of parameters (shell script)
echo $2	# Echo second parameter (shell script)
echo $*	# Echo all parameters (shell script)
.in -0.25i
.fi



