
: | 651
Bash and Korn
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
Restricted shells are not used much in practice, as they are difficult to set up
correctly.
Built-in Commands (Bash and Korn Shells)
Examples to be entered as a command line are shown with the $ prompt. Other-
wise, examples should be treated as code fragments that might be included in a
shell script. For convenience, some of the reserved words used by multiline
commands are also included.
!
! pipeline
Not ksh88. Negate the sense of a pipeline. Returns an exit status of
0 if the pipeline exited nonzero, and an exit status of 1 if the pipe-
line exited zero. Typically used in if and while statements.
Example
This code prints a message if user jane is not logged on:
if ! who | grep jane > /dev/null
then
echo jane is not currently logged on
fi
#
#
Ignore all text that follows on the same line. # is used in shell
scripts as the comment character and is not really a command.
#!shell
#!shell [option]
Used as the first line of a script to invoke the named shell. Anything
given on the rest of the line is passed as a single argument to the
named shell. This feature is typically implemented by the kernel,
but may not be supported on some older systems. Some systems
have a limit of approximately 32 characters on the maximum
length of shell. For example:
#!/bin/sh
:
:
Null command. Returns