| 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 many systems, /bin/sh is 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 in the bash(1) manpage. 4.2.1. Options 4.2.1.1. 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 commands goes to file descriptor 1; all other shell output goes to file descriptor 2. -, -- End option processing. 4.2.1.2. Bash options -O option Enable shopt option option. --debugger Read the debugging profile at start-up, turn on the exTDebug option to shopt, and enable function tracing. For use by the Bash debugger. --dump-po-strings Same as -D, but output in GNU gettext format. --dump-strings Same as -D. --help Print a usage message and exit successfully. --init-file file,--rcfile file Use file as the start-up file instead of ~/.bashrc for interactive shells. --login Shell is a login shell. --noediting Do not use the readline library for input, even in an interactive shell. --noprofile Do not read /etc/profile or any of the personal start-up files. --norc Do not read ~/.bashrc. Enabled automatically when invoked as sh. --posix Turn on POSIX mode. --restricted Same as -r. --verbose Same as set -v; the shell prints lines as it reads them. --version Print a version message and exit. The remaining options to Bash and ksh are listed under the set built-in command. 4.2.2. Arguments Arguments are assigned in order to the positional parameters $1, $2, etc. If the first argument is an executable script, commands are read from it, and the remaining arguments are assigned to $1, $2, etc. The name of the script is available as $0. |