
Invoking the Shell | 625
Bash and Korn
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
• Associative arrays
• More ways to match patterns
Invoking the Shell
The command interpreter for the Bash shell (bash) or the Korn shell (ksh) can be
invoked as follows:
bash [options] [arguments]
ksh [options] [arguments]
ksh and Bash can execute commands from a terminal, from a file (when the first
argument is an executable script), or from standard input (if no arguments remain
or if -s is specified). Both shells automatically print prompts if standard input is a
terminal, or if -i is given on the command line.
On Linux systems, /bin/sh is generally a link to Bash. When invoked as sh, Bash acts
more like the traditional Bourne shell: Login shells read /etc/profile and ~/.profile,
and regular shells read $ENV, if it’s set. Full details are available on the bash(1)
manpage.
Options
Common options
-c str
Read commands from string str.
-D Print all $"..." strings in the program. Not ksh88.
-i Create an interactive shell (prompt for input).
-p Start up as a privileged user. Bash: Don’t read $ENV or $BASH_ENV, don’t
import functions from the environment, and ignore the value of
$SHELLOPTS. Korn shell: Don’t process $HOME/.profile, read /etc/suid_
profile instead of $ENV.
-r Create a restricted shell.
-s Read commands from standard input; output from built-in ...