BASH topics - rlh 2/9/00 A good source of help in the exam are the man pages for bash. They are searchable. Sometimes we can just search for the string in question which we see in the script we are trying to decypher. At other times it would help if we knew what we were looking for. That is the primary purpose of this document. A secondary purpose is to show the general structure of the man pages for bash, which is hard to see when you are looking at a screenful at a time. This document should give a sense of what is contained in bash and how it is organized. It should also dispel the nagging sense that bash is a bottomless pit. There IS an end to it. The following is a list of specific strings (patterns) to search for online. These are listed in the order of occurence in the man pages. Care has been taken to list these strings exactly as found in the man pages, so searching for patterns will work. There is a command like "more" which prints a screenful at a time, but it has the advantage of letting you scroll backwards as well as forwards. The command is called "less". You can "man less" and see how it works. When you invoke man, less is used as the default pager for it. So whatever you can do in less you can do while viewing a man page. Here are two keys to moving around (in less) in the man pages: 1) "h" will give you a short command summary for less, telling you how to page up and down, and move a line up and a line down in the man pages, and more than you wanted to know. 2) "/pattern", where pattern is a string you are searching for, such as a command, option, switch or whatever is of interest. /pattern -- searches forward; ?pattern -- searches backward. The pattern can have spaces in it, so you can search for a phrase, as well as a word. The headings and topics listed below are items one might want to search for, to index into a specific desired page. Then you can scroll up and down to see the context of the point where you have landed. Except for shell variables, the upper case stuff tends to be major headings. Where small items are spread out with tabs, treat the items as separate; don't include any tabs. When searching for these strings it is often useful to add a space before and after the string, yet occasionally that will ruin the search. Experiment. In some cases, like the listing of "Compound Commands", the complete syntax is cited, while for search purposes a substring would be enough. Certainly there is a lot here that goes beyond this class, and yet there is a lot that has been omitted. The READLINE section is quite long (10 pages) with many special commands which are not listed here, for example. On the other hand I have listed all of the Shell Builtin Commands, but not all of their options. It has been valuable to me to write the list, I hope it's useful to you as a study tool too. For a short list see /home/rhodes/notes/BASHMAN.HDR or http://www.smsys.com/pub/lnxnotes/BASHMAN.HDR * * * * * * cut here * * * * * * Long list of topics in the BASH man pages for version 1.14.7(1) of bash (which we are using at NSCC): NAME SYNOPSIS COPYRIGHT DESCRIPTION OPTIONS -c -i -s - -norc -noprofile -rcfile -version -quiet -login -nobracexpansion -nolineediting -posix ARGUMENTS DEFINITIONS blank word name metacharacter control operator RESERVED WORDS ! case do done elif else esac fi for function if in select then until while { } SHELL GRAMMAR Simple Commands Pipelines Lists Compound Commands (list) { list; } for name [ in word; ] do list ; done select name [ in word; ] do list ; done case word in [ pattern [ | pattern ] ... ) list ;; ] ... esac if list then list [ elif list then list ] ... [ else list ] fi while list do list done until list do list done [ function ] name () { list; } COMMENTS QUOTING PARAMETERS Positional Parameters Special Parameters * @ # ? - $ ! 0 _ Shell Variables PPID PWD OLDPWD REPLY UID EUID BASH BASH_VERSION SHLVL RANDOM SECONDS LINENO HISTCMD OPTARG OPTIND HOSTTYPE OSTYPE IFS PATH HOME CDPATH ENV MAIL MAILCHECK MAILPATH MAIL_WARNING PS1 PS2 PS3 PS4 HISTSIZE HISTFILE HISTFILESIZE OPTERR PROMPT_COMMAND IGNOREEOF TMOUT FCEDIT FIGNORE INPUTRC notify history_control HISTCONTROL command_oriented_history glob_dot_filenames allow_null_glob_expansion histchars nolinks hostname_completion_file HOSTFILE noclobber auto_resume no_exit_on_failed_exec cdable_vars EXPANSION Brace Expansion Tilde Expansion Parameter Expansion ${parameter} ${parameter:-word} ${parameter:=word} ${parameter:?word} ${parameter:+word} ${#parameter} ${parameter#word} ${parameter##word} ${parameter%word} ${parameter%%word} Command Substitution $(command) `command` Arithmetic Expansion $[expression] $((expression)) Process Substitution Word Splitting Pathname Expansion Quote Removal REDIRECTION Redirecting Input Redirecting Output Appending Redirected Output Redirecting Standard Output and Standard Error Duplicating File Descriptors Opening File Descriptors for Reading and Writing FUNCTIONS ALIASES JOB CONTROL SIGNALS COMMAND EXECUTION ENVIRONMENT EXIT STATUS PROMPTING \t \d \n \s \w \W \u \h \# \! \$ \nnn \\ \[ \] READLINE The default key-bindings The following symbolic character names are recognized: RUBOUT, DEL, ESC, LFD, NEWLINE, RET, RETURN, SPC, SPACE, and TAB. The full set of escape sequences \C- \M- \e \\ \" \' Readline has variables set variable-name value performed as a result of tests $if $endif $else list of the names of the commands and default key sequences to which they are bound. Commands for Moving Commands for Manipulating the History Commands for Changing Text Killing and Yanking Numeric Arguments Completing Keyboard Macros Miscellaneous HISTORY HISTORY EXPANSION Event Designators Word Designators Modifiers ARITHMETIC EVALUATION - + ! ~ * / % + - << >> <= >= < > == != & ^ | && || = *= /= %= += -= <<= >>= &= ^= |= SHELL BUILTIN COMMANDS : . source alias bg bind break builtin cd command continue declare typeset dirs echo enable eval exec exit export fc fg getopts hash help history jobs kill let local logout popd pushd pwd read readonly return set -a -b -e -f -h -k -m -n -o -p -t -u -v -x -l -d -C -H -P -- - shift suspend test expr [ expr ] -b -c -d -e -f -g -k -L -P -r -s -S -t -u -w -x -O -G -nt -ot -ef -z -n = != ! expr -a -o -eq -ne -lt -le -gt -ge times trap type ulimit umask unalias unset wait INVOCATION Login shells: Non-login interactive shells: Non-interactive shells: SEE ALSO FILES AUTHORS BUG REPOPRTS BUGS End of BASH document.