1This is Info file features.info, produced by Makeinfo-1.55 from the 2input file features.texi. 3 4This text is a brief description of the features that are present in 5the Bash shell. 6 7This is Edition 1.14, last updated 31 May 1994, 8of `The GNU Bash Features Guide', 9for `bash', Version 1.14. 10 11Copyright (C) 1991, 1993 Free Software Foundation, Inc. 12 13This file is part of GNU Bash, the Bourne Again SHell. 14 15Bash is free software; you can redistribute it and/or modify it 16under the terms of the GNU General Public License as published by 17the Free Software Foundation; either version 1, or (at your option) 18any later version. 19 20Bash is distributed in the hope that it will be useful, but WITHOUT 21ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 22or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 23License for more details. 24 25You should have received a copy of the GNU General Public License 26along with Bash; see the file COPYING. If not, write to the Free 27Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 28 29 30File: features.info, Node: Top, Next: Bourne Shell Features, Prev: (DIR), Up: (DIR) 31 32Bash Features 33************* 34 35 Bash contains features that appear in other popular shells, and some 36features that only appear in Bash. Some of the shells that Bash has 37borrowed concepts from are the Bourne Shell (`sh'), the Korn Shell 38(`ksh'), and the C-shell (`csh' and its successor, `tcsh'). The 39following menu breaks the features up into categories based upon which 40one of these other shells inspired the feature. 41 42 This manual is meant as a brief introduction to features found in 43Bash. The Bash manual page should be used as the definitive reference 44on shell behavior. 45 46* Menu: 47 48* Bourne Shell Features:: Features originally found in the 49 Bourne shell. 50 51* Csh Features:: Features originally found in the 52 Berkeley C-Shell. 53 54* Korn Shell Features:: Features originally found in the Korn 55 Shell. 56 57* Bash Specific Features:: Features found only in Bash. 58 59* Job Control:: A chapter describing what job control is 60 and how bash allows you to use it. 61 62* Using History Interactively:: Chapter dealing with history expansion 63 rules. 64 65* Command Line Editing:: Chapter describing the command line 66 editing features. 67 68* Variable Index:: Quick reference helps you find the 69 variable you want. 70 71* Concept Index:: General index for this manual. 72 73 74File: features.info, Node: Bourne Shell Features, Next: Csh Features, Prev: Top, Up: Top 75 76Bourne Shell Style Features 77*************************** 78 79 Bash is an acronym for Bourne Again SHell. The Bourne shell is the 80traditional Unix shell originally written by Stephen Bourne. All of 81the Bourne shell builtin commands are available in Bash, and the rules 82for evaluation and quoting are taken from the Posix 1003.2 83specification for the `standard' Unix shell. 84 85 This section briefly summarizes things which Bash inherits from the 86Bourne shell: shell control structures, builtins, variables, and other 87features. It also lists the significant differences between Bash and 88the Bourne Shell. 89 90* Menu: 91 92* Looping Constructs:: Shell commands for iterative action. 93* Conditional Constructs:: Shell commands for conditional execution. 94* Shell Functions:: Grouping commands by name. 95* Bourne Shell Builtins:: Builtin commands inherited from the Bourne 96 Shell. 97* Bourne Shell Variables:: Variables which Bash uses in the same way 98 as the Bourne Shell. 99* Other Bourne Shell Features:: Addtional aspects of Bash which behave in 100 the same way as the Bourne Shell. 101 102 103File: features.info, Node: Looping Constructs, Next: Conditional Constructs, Up: Bourne Shell Features 104 105Looping Constructs 106================== 107 108 Note that wherever you see a `;' in the description of a command's 109syntax, it may be replaced indiscriminately with one or more newlines. 110 111 Bash supports the following looping constructs. 112 113`until' 114 The syntax of the `until' command is: 115 until TEST-COMMANDS; do CONSEQUENT-COMMANDS; done 116 Execute CONSEQUENT-COMMANDS as long as the final command in 117 TEST-COMMANDS has an exit status which is not zero. 118 119`while' 120 The syntax of the `while' command is: 121 while TEST-COMMANDS; do CONSEQUENT-COMMANDS; done 122 123 Execute CONSEQUENT-COMMANDS as long as the final command in 124 TEST-COMMANDS has an exit status of zero. 125 126`for' 127 The syntax of the for command is: 128 129 for NAME [in WORDS ...]; do COMMANDS; done 130 Execute COMMANDS for each member in WORDS, with NAME bound to the 131 current member. If "`in WORDS'" is not present, "`in "$@"'" is 132 assumed. 133 134 135File: features.info, Node: Conditional Constructs, Next: Shell Functions, Prev: Looping Constructs, Up: Bourne Shell Features 136 137Conditional Constructs 138====================== 139 140`if' 141 The syntax of the `if' command is: 142 143 if TEST-COMMANDS; then 144 CONSEQUENT-COMMANDS; 145 [elif MORE-TEST-COMMANDS; then 146 MORE-CONSEQUENTS;] 147 [else ALTERNATE-CONSEQUENTS;] 148 fi 149 150 Execute CONSEQUENT-COMMANDS only if the final command in 151 TEST-COMMANDS has an exit status of zero. Otherwise, each `elif' 152 list is executed in turn, and if its exit status is zero, the 153 corresponding MORE-CONSEQUENTS is executed and the command 154 completes. If "`else ALTERNATE-CONSEQUENTS'" is present, and the 155 final command in the final `if' or `elif' clause has a non-zero 156 exit status, then execute ALTERNATE-CONSEQUENTS. 157 158`case' 159 The syntax of the `case' command is: 160 161 `case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac' 162 163 Selectively execute COMMANDS based upon WORD matching PATTERN. 164 The ``|'' is used to separate multiple patterns. 165 166 Here is an example using `case' in a script that could be used to 167 describe an interesting feature of an animal: 168 169 echo -n "Enter the name of an animal: " 170 read ANIMAL 171 echo -n "The $ANIMAL has " 172 case $ANIMAL in 173 horse | dog | cat) echo -n "four";; 174 man | kangaroo ) echo -n "two";; 175 *) echo -n "an unknown number of";; 176 esac 177 echo "legs." 178 179 180File: features.info, Node: Shell Functions, Next: Bourne Shell Builtins, Prev: Conditional Constructs, Up: Bourne Shell Features 181 182Shell Functions 183=============== 184 185 Shell functions are a way to group commands for later execution 186using a single name for the group. They are executed just like a 187"regular" command. Shell functions are executed in the current shell 188context; no new process is created to interpret them. 189 190 Functions are declared using this syntax: 191 192 [ `function' ] NAME () { COMMAND-LIST; } 193 194 This defines a function named NAME. The BODY of the function is the 195COMMAND-LIST between { and }. This list is executed whenever NAME is 196specified as the name of a command. The exit status of a function is 197the exit status of the last command executed in the body. 198 199 When a function is executed, the arguments to the function become 200the positional parameters during its execution. The special parameter 201`#' that gives the number of positional parameters is updated to 202reflect the change. Positional parameter 0 is unchanged. 203 204 If the builtin command `return' is executed in a function, the 205function completes and execution resumes with the next command after 206the function call. When a function completes, the values of the 207positional parameters and the special parameter `#' are restored to the 208values they had prior to function execution. 209 210 211File: features.info, Node: Bourne Shell Builtins, Next: Bourne Shell Variables, Prev: Shell Functions, Up: Bourne Shell Features 212 213Bourne Shell Builtins 214===================== 215 216 The following shell builtin commands are inherited from the Bourne 217shell. These commands are implemented as specified by the Posix 1003.2 218standard. 219 220`:' 221 Do nothing beyond expanding any arguments and performing 222 redirections. 223 224`.' 225 Read and execute commands from the FILENAME argument in the 226 current shell context. 227 228`break' 229 Exit from a `for', `while', or `until' loop. 230 231`cd' 232 Change the current working directory. 233 234`continue' 235 Resume the next iteration of an enclosing `for', `while', or 236 `until' loop. 237 238`echo' 239 Print the arguments, separated by spaces, to the standard output. 240 241`eval' 242 The arguments are concatenated together into a single command, 243 which is then read and executed. 244 245`exec' 246 If a COMMAND argument is supplied, it replaces the shell. If no 247 COMMAND is specified, redirections may be used to affect the 248 current shell environment. 249 250`exit' 251 Exit the shell. 252 253`export' 254 Mark the arguments as variables to be passed to child processes in 255 the environment. 256 257`getopts' 258 Parse options to shell scripts or functions. 259 260`hash' 261 Remember the full pathnames of commands specified as arguments, so 262 they need not be searched for on subsequent invocations. 263 264`kill' 265 Send a signal to a process. 266 267`pwd' 268 Print the current working directory. 269 270`read' 271 Read a line from the shell input and use it to set the values of 272 specified variables. 273 274`readonly' 275 Mark variables as unchangable. 276 277`return' 278 Cause a shell function to exit with a specified value. 279 280`shift' 281 Shift positional parameters to the left. 282 283`test' 284`[' 285 Evaluate a conditional expression. 286 287`times' 288 Print out the user and system times used by the shell and its 289 children. 290 291`trap' 292 Specify commands to be executed when the shell receives signals. 293 294`umask' 295 Set the shell process's file creation mask. 296 297`unset' 298 Cause shell variables to disappear. 299 300`wait' 301 Wait until child processes exit and report their exit status. 302 303 304File: features.info, Node: Bourne Shell Variables, Next: Other Bourne Shell Features, Prev: Bourne Shell Builtins, Up: Bourne Shell Features 305 306Bourne Shell Variables 307====================== 308 309 Bash uses certain shell variables in the same way as the Bourne 310shell. In some cases, Bash assigns a default value to the variable. 311 312`IFS' 313 A list of characters that separate fields; used when the shell 314 splits words as part of expansion. 315 316`PATH' 317 A colon-separated list of directories in which the shell looks for 318 commands. 319 320`HOME' 321 The current user's home directory. 322 323`CDPATH' 324 A colon-separated list of directories used as a search path for 325 the `cd' command. 326 327`MAILPATH' 328 A colon-separated list of files which the shell periodically checks 329 for new mail. You can also specify what message is printed by 330 separating the file name from the message with a `?'. When used 331 in the text of the message, `$_' stands for the name of the 332 current mailfile. 333 334`PS1' 335 The primary prompt string. 336 337`PS2' 338 The secondary prompt string. 339 340`OPTIND' 341 The index of the last option processed by the `getopts' builtin. 342 343`OPTARG' 344 The value of the last option argument processed by the `getopts' 345 builtin. 346 347 348File: features.info, Node: Other Bourne Shell Features, Prev: Bourne Shell Variables, Up: Bourne Shell Features 349 350Other Bourne Shell Features 351=========================== 352 353* Menu: 354 355* Major Differences from the Bourne Shell:: Major differences between 356 Bash and the Bourne shell. 357 358 Bash implements essentially the same grammar, parameter and variable 359expansion, redirection, and quoting as the Bourne Shell. Bash uses the 360Posix 1003.2 standard as the specification of how these features are to 361be implemented. There are some differences between the traditional 362Bourne shell and the Posix standard; this section quickly details the 363differences of significance. A number of these differences are 364explained in greater depth in subsequent sections. 365 366 367File: features.info, Node: Major Differences from the Bourne Shell, Up: Other Bourne Shell Features 368 369Major Differences from the Bourne Shell 370--------------------------------------- 371 372 Bash implements the `!' keyword to negate the return value of a 373pipeline. Very useful when an `if' statement needs to act only if a 374test fails. 375 376 Bash includes brace expansion (*note Brace Expansion::.). 377 378 Bash includes the Posix and `ksh'-style pattern removal `%%' and 379`##' constructs to remove leading or trailing substrings from variables. 380 381 The Posix and `ksh'-style `$()' form of command substitution is 382implemented, and preferred to the Bourne shell's ```' (which is also 383implemented for backwards compatibility). 384 385 Variables present in the shell's initial environment are 386automatically exported to child processes. The Bourne shell does not 387normally do this unless the variables are explicitly marked using the 388`export' command. 389 390 The expansion `${#xx}', which returns the length of `$xx', is 391supported. 392 393 The `IFS' variable is used to split only the results of expansion, 394not all words. This closes a longstanding shell security hole. 395 396 It is possible to have a variable and a function with the same name; 397`sh' does not separate the two name spaces. 398 399 Bash functions are permitted to have local variables, and thus useful 400recursive functions may be written. 401 402 The `noclobber' option is available to avoid overwriting existing 403files with output redirection. 404 405 Bash allows you to write a function to override a builtin, and 406provides access to that builtin's functionality within the function via 407the `builtin' and `command' builtins. 408 409 The `command' builtin allows selective disabling of functions when 410command lookup is performed. 411 412 Individual builtins may be enabled or disabled using the `enable' 413builtin. 414 415 Functions may be exported to children via the environment. 416 417 The Bash `read' builtin will read a line ending in \ with the `-r' 418option, and will use the `$REPLY' variable as a default if no arguments 419are supplied. 420 421 The `return' builtin may be used to abort execution of scripts 422executed with the `.' or `source' builtins. 423 424 The `umask' builtin allows symbolic mode arguments similar to those 425accepted by `chmod'. 426 427 The `test' builtin is slightly different, as it implements the Posix 4281003.2 algorithm, which specifies the behavior based on the number of 429arguments. 430 431 432File: features.info, Node: Csh Features, Next: Korn Shell Features, Prev: Bourne Shell Features, Up: Top 433 434C-Shell Style Features 435********************** 436 437 The C-Shell ("`csh'") was created by Bill Joy at UC Berkeley. It is 438generally considered to have better features for interactive use than 439the original Bourne shell. Some of the `csh' features present in Bash 440include job control, history expansion, `protected' redirection, and 441several variables for controlling the interactive behaviour of the shell 442(e.g. `IGNOREEOF'). 443 444 *Note Using History Interactively:: for details on history expansion. 445 446* Menu: 447 448* Tilde Expansion:: Expansion of the ~ character. 449* Brace Expansion:: Expansion of expressions within braces. 450* C Shell Builtins:: Builtin commands adopted from the C Shell. 451* C Shell Variables:: Variables which Bash uses in essentially 452 the same way as the C Shell. 453 454 455File: features.info, Node: Tilde Expansion, Next: Brace Expansion, Up: Csh Features 456 457Tilde Expansion 458=============== 459 460 Bash has tilde (~) expansion, similar, but not identical, to that of 461`csh'. The following table shows what unquoted words beginning with a 462tilde expand to. 463 464`~' 465 The current value of `$HOME'. 466 467`~/foo' 468 `$HOME/foo' 469 470`~fred/foo' 471 The subdirectory `foo' of the home directory of the user `fred'. 472 473`~+/foo' 474 `$PWD/foo' 475 476`~-' 477 `$OLDPWD/foo' 478 479 Bash will also tilde expand words following redirection operators 480and words following `=' in assignment statements. 481 482 483File: features.info, Node: Brace Expansion, Next: C Shell Builtins, Prev: Tilde Expansion, Up: Csh Features 484 485Brace Expansion 486=============== 487 488 Brace expansion is a mechanism by which arbitrary strings may be 489generated. This mechanism is similar to PATHNAME EXPANSION (see the 490Bash manual page for details), but the file names generated need not 491exist. Patterns to be brace expanded take the form of an optional 492PREAMBLE, followed by a series of comma-separated strings between a 493pair of braces, followed by an optional POSTAMBLE. The preamble is 494prepended to each string contained within the braces, and the postamble 495is then appended to each resulting string, expanding left to right. 496 497 Brace expansions may be nested. The results of each expanded string 498are not sorted; left to right order is preserved. For example, 499 a{d,c,b}e 500 expands into ADE ACE ABE. 501 502 Brace expansion is performed before any other expansions, and any 503characters special to other expansions are preserved in the result. It 504is strictly textual. Bash does not apply any syntactic interpretation 505to the context of the expansion or the text between the braces. 506 507 A correctly-formed brace expansion must contain unquoted opening and 508closing braces, and at least one unquoted comma. Any incorrectly 509formed brace expansion is left unchanged. 510 511 This construct is typically used as shorthand when the common prefix 512of the strings to be generated is longer than in the above example: 513 mkdir /usr/local/src/bash/{old,new,dist,bugs} 514 or 515 chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}} 516 517 518File: features.info, Node: C Shell Builtins, Next: C Shell Variables, Prev: Brace Expansion, Up: Csh Features 519 520C Shell Builtins 521================ 522 523 Bash has several builtin commands whose definition is very similar 524to `csh'. 525 526`pushd' 527 pushd [DIR | +N | -N] 528 529 Save the current directory on a list and then `cd' to DIR. With no 530 arguments, exchanges the top two directories. 531 532 `+N' 533 Brings the Nth directory (counting from the left of the list 534 printed by `dirs') to the top of the list by rotating the 535 stack. 536 537 `-N' 538 Brings the Nth directory (counting from the right of the list 539 printed by `dirs') to the top of the list by rotating the 540 stack. 541 542 `DIR' 543 Makes the current working directory be the top of the stack, 544 and then CDs to DIR. You can see the saved directory list 545 with the `dirs' command. 546 547`popd' 548 popd [+N | -N] 549 550 Pops the directory stack, and `cd's to the new top directory. When 551 no arguments are given, removes the top directory from the stack 552 and `cd's to the new top directory. The elements are numbered 553 from 0 starting at the first directory listed with `dirs'; i.e. 554 `popd' is equivalent to `popd +0'. 555 `+N' 556 Removes the Nth directory (counting from the left of the list 557 printed by `dirs'), starting with zero. 558 559 `-N' 560 Removes the Nth directory (counting from the right of the 561 list printed by `dirs'), starting with zero. 562 563`dirs' 564 dirs [+N | -N] [-L] 565 Display the list of currently remembered directories. Directories 566 find their way onto the list with the `pushd' command; you can get 567 back up through the list with the `popd' command. 568 `+N' 569 Displays the Nth directory (counting from the left of the 570 list printed by `dirs' when invoked without options), starting 571 with zero. 572 573 `-N' 574 Displays the Nth directory (counting from the right of the 575 list printed by `dirs' when invoked without options), starting 576 with zero. 577 578 `-L' 579 Produces a longer listing; the default listing format uses a 580 tilde to denote the home directory. 581 582`history' 583 history [N] [ [-w -r -a -n] [FILENAME]] 584 585 Display the history list with line numbers. Lines prefixed with 586 with a `*' have been modified. An argument of N says to list only 587 the last N lines. Option `-w' means write out the current history 588 to the history file; `-r' means to read the current history file 589 and make its contents the history list. An argument of `-a' means 590 to append the new history lines (history lines entered since the 591 beginning of the current Bash session) to the history file. 592 Finally, the `-n' argument means to read the history lines not 593 already read from the history file into the current history list. 594 These are lines appended to the history file since the beginning 595 of the current Bash session. If FILENAME is given, then it is used 596 as the history file, else if `$HISTFILE' has a value, that is 597 used, otherwise `~/.bash_history' is used. 598 599`logout' 600 Exit a login shell. 601 602`source' 603 A synonym for `.' (*note Bourne Shell Builtins::.) 604 605 606File: features.info, Node: C Shell Variables, Prev: C Shell Builtins, Up: Csh Features 607 608C Shell Variables 609================= 610 611`IGNOREEOF' 612 If this variable is set, it represents the number of consecutive 613 `EOF's Bash will read before exiting. By default, Bash will exit 614 upon reading a single `EOF'. 615 616`cdable_vars' 617 If this variable is set, Bash treats arguments to the `cd' command 618 which are not directories as names of variables whose values are 619 the directories to change to. 620 621 622File: features.info, Node: Korn Shell Features, Next: Bash Specific Features, Prev: Csh Features, Up: Top 623 624Korn Shell Style Features 625************************* 626 627 This section describes features primarily inspired by the Korn Shell 628(`ksh'). In some cases, the Posix 1003.2 standard has adopted these 629commands and variables from the Korn Shell; Bash implements those 630features using the Posix standard as a guide. 631 632* Menu: 633 634* Korn Shell Constructs:: Shell grammar constructs adopted from the 635 Korn Shell 636* Korn Shell Builtins:: Builtin commands adopted from the Korn Shell. 637* Korn Shell Variables:: Variables which bash uses in essentially 638 the same way as the Korn Shell. 639* Aliases:: Substituting one command for another. 640 641 642File: features.info, Node: Korn Shell Constructs, Next: Korn Shell Builtins, Up: Korn Shell Features 643 644Korn Shell Constructs 645===================== 646 647 Bash includes the Korn Shell `select' construct. This construct 648allows the easy generation of menus. It has almost the same syntax as 649the `for' command. 650 651 The syntax of the `select' command is: 652 select NAME [in WORDS ...]; do COMMANDS; done 653 654 The list of words following `in' is expanded, generating a list of 655items. The set of expanded words is printed on the standard error, 656each preceded by a number. If the "`in WORDS'" is omitted, the 657positional parameters are printed. The `PS3' prompt is then displayed 658and a line is read from the standard input. If the line consists of the 659number corresponding to one of the displayed words, then the value of 660NAME is set to that word. If the line is empty, the words and prompt 661are displayed again. If `EOF' is read, the `select' command completes. 662Any other value read causes NAME to be set to null. The line read is 663saved in the variable `REPLY'. 664 665 The COMMANDS are executed after each selection until a `break' or 666`return' command is executed, at which point the `select' command 667completes. 668 669 670File: features.info, Node: Korn Shell Builtins, Next: Korn Shell Variables, Prev: Korn Shell Constructs, Up: Korn Shell Features 671 672Korn Shell Builtins 673=================== 674 675 This section describes Bash builtin commands taken from `ksh'. 676 677`fc' 678 `fc [-e ENAME] [-nlr] [FIRST] [LAST]' 679 `fc -s [PAT=REP] [COMMAND]' 680 681 Fix Command. In the first form, a range of commands from FIRST to 682 LAST is selected from the history list. Both FIRST and LAST may 683 be specified as a string (to locate the most recent command 684 beginning with that string) or as a number (an index into the 685 history list, where a negative number is used as an offset from the 686 current command number). If LAST is not specified it is set to 687 FIRST. If FIRST is not specified it is set to the previous 688 command for editing and -16 for listing. If the `-l' flag is 689 given, the commands are listed on standard output. The `-n' flag 690 suppresses the command numbers when listing. The `-r' flag 691 reverses the order of the listing. Otherwise, the editor given by 692 ENAME is invoked on a file containing those commands. If ENAME is 693 not given, the value of the following variable expansion is used: 694 `${FCEDIT:-${EDITOR:-vi}}'. This says to use the value of the 695 `FCEDIT' variable if set, or the value of the `EDITOR' variable if 696 that is set, or `vi' if neither is set. When editing is complete, 697 the edited commands are echoed and executed. 698 699 In the second form, COMMAND is re-executed after each instance of 700 PAT in the selected command is replaced by REP. 701 702 A useful alias to use with the `fc' command is `r='fc -s'', so 703 that typing `r cc' runs the last command beginning with `cc' and 704 typing `r' re-executes the last command (*note Aliases::.). 705 706`let' 707 The `let' builtin allows arithmetic to be performed on shell 708 variables. For details, refer to *Note Arithmetic Builtins::. 709 710`typeset' 711 The `typeset' command is supplied for compatibility with the Korn 712 shell; however, it has been made obsolete by the `declare' command 713 (*note Bash Builtins::.). 714 715 716File: features.info, Node: Korn Shell Variables, Next: Aliases, Prev: Korn Shell Builtins, Up: Korn Shell Features 717 718Korn Shell Variables 719==================== 720 721`REPLY' 722 The default variable for the `read' builtin. 723 724`RANDOM' 725 Each time this parameter is referenced, a random integer is 726 generated. Assigning a value to this variable seeds the random 727 number generator. 728 729`SECONDS' 730 This variable expands to the number of seconds since the shell was 731 started. Assignment to this variable resets the count to the 732 value assigned, and the expanded value becomes the value assigned 733 plus the number of seconds since the assignment. 734 735`PS3' 736 The value of this variable is used as the prompt for the `select' 737 command. 738 739`PS4' 740 This is the prompt printed before the command line is echoed when 741 the `-x' option is set (*note The Set Builtin::.). 742 743`PWD' 744 The current working directory as set by the `cd' builtin. 745 746`OLDPWD' 747 The previous working directory as set by the `cd' builtin. 748 749`TMOUT' 750 If set to a value greater than zero, the value is interpreted as 751 the number of seconds to wait for input after issuing the primary 752 prompt. Bash terminates after that number of seconds if input does 753 not arrive. 754 755 756File: features.info, Node: Aliases, Prev: Korn Shell Variables, Up: Korn Shell Features 757 758Aliases 759======= 760 761* Menu: 762 763* Alias Builtins:: Builtins commands to maniuplate aliases. 764 765 The shell maintains a list of ALIASES that may be set and unset with 766the `alias' and `unalias' builtin commands. 767 768 The first word of each command, if unquoted, is checked to see if it 769has an alias. If so, that word is replaced by the text of the alias. 770The alias name and the replacement text may contain any valid shell 771input, including shell metacharacters, with the exception that the 772alias name may not contain =. The first word of the replacement text 773is tested for aliases, but a word that is identical to an alias being 774expanded is not expanded a second time. This means that one may alias 775`ls' to `"ls -F"', for instance, and Bash does not try to recursively 776expand the replacement text. If the last character of the alias value 777is a space or tab character, then the next command word following the 778alias is also checked for alias expansion. 779 780 Aliases are created and listed with the `alias' command, and removed 781with the `unalias' command. 782 783 There is no mechanism for using arguments in the replacement text, 784as in `csh'. If arguments are needed, a shell function should be used. 785 786 Aliases are not expanded when the shell is not interactive. 787 788 The rules concerning the definition and use of aliases are somewhat 789confusing. Bash always reads at least one complete line of input 790before executing any of the commands on that line. Aliases are 791expanded when a command is read, not when it is executed. Therefore, an 792alias definition appearing on the same line as another command does not 793take effect until the next line of input is read. This means that the 794commands following the alias definition on that line are not affected 795by the new alias. This behavior is also an issue when functions are 796executed. Aliases are expanded when the function definition is read, 797not when the function is executed, because a function definition is 798itself a compound command. As a consequence, aliases defined in a 799function are not available until after that function is executed. To 800be safe, always put alias definitions on a separate line, and do not 801use `alias' in compound commands. 802 803 Note that for almost every purpose, aliases are superseded by shell 804functions. 805 806 807File: features.info, Node: Alias Builtins, Up: Aliases 808 809Alias Builtins 810-------------- 811 812`alias' 813 alias [NAME[=VALUE] ...] 814 815 Without arguments, print the list of aliases on the standard 816 output. If arguments are supplied, an alias is defined for each 817 NAME whose VALUE is given. If no VALUE is given, the name and 818 value of the alias is printed. 819 820`unalias' 821 unalias [-a] [NAME ... ] 822 823 Remove each NAME from the list of aliases. If `-a' is supplied, 824 all aliases are removed. 825 826 827File: features.info, Node: Bash Specific Features, Next: Job Control, Prev: Korn Shell Features, Up: Top 828 829Bash Specific Features 830********************** 831 832 This section describes the features unique to Bash. 833 834* Menu: 835 836* Command Line Options:: Command line options that you can give 837 to Bash. 838* Bash Startup Files:: When and how Bash executes scripts. 839* Is This Shell Interactive?:: Determining the state of a running Bash. 840* Bash Builtins:: Table of builtins specific to Bash. 841* The Set Builtin:: This builtin is so overloaded it 842 deserves its own section. 843* Bash Variables:: List of variables that exist in Bash. 844* Shell Arithmetic:: Arithmetic on shell variables. 845* Printing a Prompt:: Controlling the PS1 string. 846 847 848File: features.info, Node: Command Line Options, Next: Bash Startup Files, Up: Bash Specific Features 849 850Shell Command Line Options 851========================== 852 853 Along with the single character shell command-line options (*Note 854The Set Builtin::) there are several other options that you can use. 855These options must appear on the command line before the single 856character command options to be recognized. 857 858`-norc' 859 Don't read the `~/.bashrc' initialization file in an interactive 860 shell. This is on by default if the shell is invoked as `sh'. 861 862`-rcfile FILENAME' 863 Execute commands from FILENAME (instead of `~/.bashrc') in an 864 interactive shell. 865 866`-noprofile' 867 Don't load the system-wide startup file `/etc/profile' or any of 868 the personal initialization files `~/.bash_profile', 869 `~/.bash_login', or `~/.profile' when bash is invoked as a login 870 shell. 871 872`-version' 873 Display the version number of this shell. 874 875`-login' 876 Make this shell act as if it were directly invoked from login. 877 This is equivalent to `exec - bash' but can be issued from another 878 shell, such as `csh'. If you wanted to replace your current login 879 shell with a Bash login shell, you would say `exec bash -login'. 880 881`-nobraceexpansion' 882 Do not perform curly brace expansion (*note Brace Expansion::.). 883 884`-nolineediting' 885 Do not use the GNU Readline library (*note Command Line Editing::.) 886 to read interactive command lines. 887 888`-posix' 889 Change the behavior of Bash where the default operation differs 890 from the Posix 1003.2 standard to match the standard. This is 891 intended to make Bash behave as a strict superset of that standard. 892 893 894File: features.info, Node: Bash Startup Files, Next: Is This Shell Interactive?, Prev: Command Line Options, Up: Bash Specific Features 895 896Bash Startup Files 897================== 898 899 When and how Bash executes startup files. 900 901 For Login shells (subject to the -noprofile option): 902 903 On logging in: 904 If `/etc/profile' exists, then source it. 905 906 If `~/.bash_profile' exists, then source it, 907 else if `~/.bash_login' exists, then source it, 908 else if `~/.profile' exists, then source it. 909 910 On logging out: 911 If `~/.bash_logout' exists, source it. 912 913 For non-login interactive shells (subject to the -norc and -rcfile options): 914 On starting up: 915 If `~/.bashrc' exists, then source it. 916 917 For non-interactive shells: 918 On starting up: 919 If the environment variable `ENV' is non-null, expand the 920 variable and source the file named by the value. If Bash is 921 not started in Posix mode, it looks for `BASH_ENV' before 922 `ENV'. 923 924 So, typically, your `~/.bash_profile' contains the line 925 `if [ -f `~/.bashrc' ]; then source `~/.bashrc'; fi' 926 927after (or before) any login specific initializations. 928 929 If Bash is invoked as `sh', it tries to mimic the behavior of `sh' 930as closely as possible. For a login shell, it attempts to source only 931`/etc/profile' and `~/.profile', in that order. The `-noprofile' 932option may still be used to disable this behavior. A shell invoked as 933`sh' does not attempt to source any other startup files. 934 935 When Bash is started in POSIX mode, as with the `-posix' command 936line option, it follows the Posix 1003.2 standard for startup files. 937In this mode, the `ENV' variable is expanded and that file sourced; no 938other startup files are read. 939 940 941File: features.info, Node: Is This Shell Interactive?, Next: Bash Builtins, Prev: Bash Startup Files, Up: Bash Specific Features 942 943Is This Shell Interactive? 944========================== 945 946 You may wish to determine within a startup script whether Bash is 947running interactively or not. To do this, examine the variable `$PS1'; 948it is unset in non-interactive shells, and set in interactive shells. 949Thus: 950 951 if [ -z "$PS1" ]; then 952 echo This shell is not interactive 953 else 954 echo This shell is interactive 955 fi 956 957 You can ask an interactive Bash to not run your `~/.bashrc' file 958with the `-norc' flag. You can change the name of the `~/.bashrc' file 959to any other file name with `-rcfile FILENAME'. You can ask Bash to 960not run your `~/.bash_profile' file with the `-noprofile' flag. 961 962 963File: features.info, Node: Bash Builtins, Next: The Set Builtin, Prev: Is This Shell Interactive?, Up: Bash Specific Features 964 965Bash Builtin Commands 966===================== 967 968 This section describes builtin commands which are unique to or have 969been extended in Bash. 970 971`builtin' 972 builtin [SHELL-BUILTIN [ARGS]] 973 Run a shell builtin. This is useful when you wish to rename a 974 shell builtin to be a function, but need the functionality of the 975 builtin within the function itself. 976 977`bind' 978 bind [-m KEYMAP] [-lvd] [-q NAME] 979 bind [-m KEYMAP] -f FILENAME 980 bind [-m KEYMAP] KEYSEQ:FUNCTION-NAME 981 982 Display current Readline (*note Command Line Editing::.) key and 983 function bindings, or bind a key sequence to a Readline function 984 or macro. The binding syntax accepted is identical to that of 985 `.inputrc' (*note Readline Init File::.), but each binding must be 986 passed as a separate argument: `"\C-x\C-r":re-read-init-file'. 987 Options, if supplied, have the following meanings: 988 989 `-m keymap' 990 Use KEYMAP as the keymap to be affected by the subsequent 991 bindings. Acceptable KEYMAP names are `emacs', 992 `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move', 993 `vi-command', and `vi-insert'. `vi' is equivalent to 994 `vi-command'; `emacs' is equivalent to `emacs-standard'. 995 996 `-l' 997 List the names of all readline functions 998 999 `-v' 1000 List current function names and bindings 1001 1002 `-d' 1003 Dump function names and bindings in such a way that they can 1004 be re-read 1005 1006 `-f filename' 1007 Read key bindings from FILENAME 1008 1009 `-q' 1010 Query about which keys invoke the named FUNCTION 1011 1012`command' 1013 command [-pVv] COMMAND [ARGS ...] 1014 Runs COMMAND with ARG ignoring shell functions. If you have a 1015 shell function called `ls', and you wish to call the command `ls', 1016 you can say `command ls'. The `-p' option means to use a default 1017 value for `$PATH' that is guaranteed to find all of the standard 1018 utilities. 1019 1020 If either the `-V' or `-v' option is supplied, a description of 1021 COMMAND is printed. The `-v' option causes a single word 1022 indicating the command or file name used to invoke COMMAND to be 1023 printed; the `-V' option produces a more verbose description. 1024 1025`declare' 1026 declare [-frxi] [NAME[=VALUE]] 1027 1028 Declare variables and/or give them attributes. If no NAMEs are 1029 given, then display the values of variables instead. `-f' means 1030 to use function names only. `-r' says to make NAMEs readonly. 1031 `-x' says to mark NAMEs for export. `-i' says that the variable 1032 is to be treated as an integer; arithmetic evaluation (*note Shell 1033 Arithmetic::.) is performed when the variable is assigned a value. 1034 Using `+' instead of `-' turns off the attribute instead. When 1035 used in a function, `declare' makes NAMEs local, as with the 1036 `local' command. 1037 1038`enable' 1039 enable [-n] [-a] [NAME ...] 1040 Enable and disable builtin shell commands. This allows you to use 1041 a disk command which has the same name as a shell builtin. If 1042 `-n' is used, the NAMEs become disabled. Otherwise NAMEs are 1043 enabled. For example, to use the `test' binary found via `$PATH' 1044 instead of the shell builtin version, type `enable -n test'. The 1045 `-a' option means to list each builtin with an indication of 1046 whether or not it is enabled. 1047 1048`help' 1049 help [PATTERN] 1050 Display helpful information about builtin commands. If PATTERN is 1051 specified, `help' gives detailed help on all commands matching 1052 PATTERN, otherwise a list of the builtins is printed. 1053 1054`local' 1055 local NAME[=VALUE] 1056 For each argument, create a local variable called NAME, and give 1057 it VALUE. `local' can only be used within a function; it makes 1058 the variable NAME have a visible scope restricted to that function 1059 and its children. 1060 1061`type' 1062 type [-all] [-type | -path] [NAME ...] 1063 For each NAME, indicate how it would be interpreted if used as a 1064 command name. 1065 1066 If the `-type' flag is used, `type' returns a single word which is 1067 one of "alias", "function", "builtin", "file" or "keyword", if 1068 NAME is an alias, shell function, shell builtin, disk file, or 1069 shell reserved word, respectively. 1070 1071 If the `-path' flag is used, `type' either returns the name of the 1072 disk file that would be executed, or nothing if `-type' would not 1073 return "file". 1074 1075 If the `-all' flag is used, returns all of the places that contain 1076 an executable named FILE. This includes aliases and functions, if 1077 and only if the `-path' flag is not also used. 1078 1079 `Type' accepts `-a', `-t', and `-p' as equivalent to `-all', 1080 `-type', and `-path', respectively. 1081 1082`ulimit' 1083 ulimit [-acdmstfpnuvSH] [LIMIT] 1084 `Ulimit' provides control over the resources available to processes 1085 started by the shell, on systems that allow such control. If an 1086 option is given, it is interpreted as follows: 1087 `-S' 1088 change and report the soft limit associated with a resource 1089 (the default if the `-H' option is not given). 1090 1091 `-H' 1092 change and report the hard limit associated with a resource. 1093 1094 `-a' 1095 all current limits are reported. 1096 1097 `-c' 1098 the maximum size of core files created. 1099 1100 `-d' 1101 the maximum size of a process's data segment. 1102 1103 `-m' 1104 the maximum resident set size. 1105 1106 `-s' 1107 the maximum stack size. 1108 1109 `-t' 1110 the maximum amount of cpu time in seconds. 1111 1112 `-f' 1113 the maximum size of files created by the shell. 1114 1115 `-p' 1116 the pipe buffer size. 1117 1118 `-n' 1119 the maximum number of open file descriptors. 1120 1121 `-u' 1122 the maximum number of processes available to a single user. 1123 1124 `-v' 1125 the maximum amount of virtual memory available to the process. 1126 1127 If LIMIT is given, it is the new value of the specified resource. 1128 Otherwise, the current value of the specified resource is printed. 1129 If no option is given, then `-f' is assumed. Values are in 1130 1024-byte increments, except for `-t', which is in seconds, `-p', 1131 which is in units of 512-byte blocks, and `-n' and `-u', which are 1132 unscaled values. 1133 1134 1135File: features.info, Node: The Set Builtin, Next: Bash Variables, Prev: Bash Builtins, Up: Bash Specific Features 1136 1137The Set Builtin 1138=============== 1139 1140 This builtin is so overloaded that it deserves its own section. 1141 1142`set' 1143 set [-abefhkmnptuvxldCHP] [-o OPTION] [ARGUMENT ...] 1144 1145 `-a' 1146 Mark variables which are modified or created for export. 1147 1148 `-b' 1149 Cause the status of terminated background jobs to be reported 1150 immediately, rather than before printing the next primary 1151 prompt. 1152 1153 `-e' 1154 Exit immediately if a command exits with a non-zero status. 1155 1156 `-f' 1157 Disable file name generation (globbing). 1158 1159 `-h' 1160 Locate and remember (hash) commands as functions are defined, 1161 rather than when the function is executed. 1162 1163 `-k' 1164 All keyword arguments are placed in the environment for a 1165 command, not just those that precede the command name. 1166 1167 `-m' 1168 Job control is enabled (*note Job Control::.). 1169 1170 `-n' 1171 Read commands but do not execute them. 1172 1173 `-o OPTION-NAME' 1174 Set the flag corresponding to OPTION-NAME: 1175 1176 `allexport' 1177 same as `-a'. 1178 1179 `braceexpand' 1180 the shell will perform brace expansion (*note Brace 1181 Expansion::.). 1182 1183 `emacs' 1184 use an emacs-style line editing interface (*note Command 1185 Line Editing::.). 1186 1187 `errexit' 1188 same as `-e'. 1189 1190 `histexpand' 1191 same as `-H'. 1192 1193 `ignoreeof' 1194 the shell will not exit upon reading EOF. 1195 1196 `interactive-comments' 1197 allow a word beginning with a `#' to cause that word and 1198 all remaining characters on that line to be ignored in an 1199 interactive shell. 1200 1201 `monitor' 1202 same as `-m'. 1203 1204 `noclobber' 1205 same as `-C'. 1206 1207 `noexec' 1208 same as `-n'. 1209 1210 `noglob' 1211 same as `-f'. 1212 1213 `nohash' 1214 same as `-d'. 1215 1216 `notify' 1217 same as `-b'. 1218 1219 `nounset' 1220 same as `-u'. 1221 1222 `physical' 1223 same as `-P'. 1224 1225 `posix' 1226 change the behavior of Bash where the default operation 1227 differs from the Posix 1003.2 standard to match the 1228 standard. This is intended to make Bash behave as a 1229 strict superset of that standard. 1230 1231 `privileged' 1232 same as `-p'. 1233 1234 `verbose' 1235 same as `-v'. 1236 1237 `vi' 1238 use a `vi'-style line editing interface. 1239 1240 `xtrace' 1241 same as `-x'. 1242 1243 `-p' 1244 Turn on privileged mode. In this mode, the `$ENV' file is 1245 not processed, and shell functions are not inherited from the 1246 environment. This is enabled automatically on startup if the 1247 effective user (group) id is not equal to the real user 1248 (group) id. Turning this option off causes the effective user 1249 and group ids to be set to the real user and group ids. 1250 1251 `-t' 1252 Exit after reading and executing one command. 1253 1254 `-u' 1255 Treat unset variables as an error when substituting. 1256 1257 `-v' 1258 Print shell input lines as they are read. 1259 1260 `-x' 1261 Print commands and their arguments as they are executed. 1262 1263 `-l' 1264 Save and restore the binding of the NAME in a `for' command. 1265 1266 `-d' 1267 Disable the hashing of commands that are looked up for 1268 execution. Normally, commands are remembered in a hash 1269 table, and once found, do not have to be looked up again. 1270 1271 `-C' 1272 Disallow output redirection to existing files. 1273 1274 `-H' 1275 Enable ! style history substitution. This flag is on by 1276 default. 1277 1278 `-P' 1279 If set, do not follow symbolic links when performing commands 1280 such as `cd' which change the current directory. The 1281 physical directory is used instead. 1282 1283 `--' 1284 If no arguments follow this flag, then the positional 1285 parameters are unset. Otherwise, the positional parameters 1286 are set to the ARGUMENTS, even if some of them begin with a 1287 `-'. 1288 1289 `-' 1290 Signal the end of options, cause all remaining ARGUMENTS to 1291 be assigned to the positional parameters. The `-x' and `-v' 1292 options are turned off. If there are no arguments, the 1293 positional parameters remain unchanged. 1294 1295 Using `+' rather than `-' causes these flags to be turned off. 1296 The flags can also be used upon invocation of the shell. The 1297 current set of flags may be found in `$-'. The remaining N 1298 ARGUMENTS are positional parameters and are assigned, in order, to 1299 `$1', `$2', .. `$N'. If no arguments are given, all shell 1300 variables are printed. 1301 1302 1303File: features.info, Node: Bash Variables, Next: Shell Arithmetic, Prev: The Set Builtin, Up: Bash Specific Features 1304 1305Bash Variables 1306============== 1307 1308 These variables are set or used by bash, but other shells do not 1309normally treat them specially. 1310 1311`HISTCONTROL' 1312`history_control' 1313 Set to a value of `ignorespace', it means don't enter lines which 1314 begin with a space or tab into the history list. Set to a value 1315 of `ignoredups', it means don't enter lines which match the last 1316 entered line. A value of `ignoreboth' combines the two options. 1317 Unset, or set to any other value than those above, means to save 1318 all lines on the history list. 1319 1320`HISTFILE' 1321 The name of the file to which the command history is saved. 1322 1323`HISTSIZE' 1324 If set, this is the maximum number of commands to remember in the 1325 history. 1326 1327`histchars' 1328 Up to three characters which control history expansion, quick 1329 substitution, and tokenization (*note History Interaction::.). 1330 The first character is the "history-expansion-char", that is, the 1331 character which signifies the start of a history expansion, 1332 normally `!'. The second character is the character which 1333 signifies `quick substitution' when seen as the first character on 1334 a line, normally `^'. The optional third character is the 1335 character which signifies the remainder of the line is a comment, 1336 when found as the first character of a word, usually `#'. The 1337 history comment character causes history substitution to be 1338 skipped for the remaining words on the line. It does not 1339 necessarily cause the shell parser to treat the rest of the line 1340 as a comment. 1341 1342`HISTCMD' 1343 The history number, or index in the history list, of the current 1344 command. If `HISTCMD' is unset, it loses its special properties, 1345 even if it is subsequently reset. 1346 1347`hostname_completion_file' 1348`HOSTFILE' 1349 Contains the name of a file in the same format as `/etc/hosts' that 1350 should be read when the shell needs to complete a hostname. You 1351 can change the file interactively; the next time you attempt to 1352 complete a hostname, Bash will add the contents of the new file to 1353 the already existing database. 1354 1355`MAILCHECK' 1356 How often (in seconds) that the shell should check for mail in the 1357 files specified in `MAILPATH'. 1358 1359`PROMPT_COMMAND' 1360 If present, this contains a string which is a command to execute 1361 before the printing of each primary prompt (`$PS1'). 1362 1363`UID' 1364 The numeric real user id of the current user. 1365 1366`EUID' 1367 The numeric effective user id of the current user. 1368 1369`HOSTTYPE' 1370 A string describing the machine Bash is running on. 1371 1372`OSTYPE' 1373 A string describing the operating system Bash is running on. 1374 1375`FIGNORE' 1376 A colon-separated list of suffixes to ignore when performing 1377 filename completion A file name whose suffix matches one of the 1378 entries in `FIGNORE' is excluded from the list of matched file 1379 names. A sample value is `.o:~' 1380 1381`INPUTRC' 1382 The name of the Readline startup file, overriding the default of 1383 `~/.inputrc'. 1384 1385`BASH_VERSION' 1386 The version number of the current instance of Bash. 1387 1388`IGNOREEOF' 1389 Controls the action of the shell on receipt of an `EOF' character 1390 as the sole input. If set, then the value of it is the number of 1391 consecutive `EOF' characters that can be read as the first 1392 characters on an input line before the shell will exit. If the 1393 variable exists but does not have a numeric value (or has no 1394 value) then the default is 10. If the variable does not exist, 1395 then `EOF' signifies the end of input to the shell. This is only 1396 in effect for interactive shells. 1397 1398`no_exit_on_failed_exec' 1399 If this variable exists, the shell will not exit in the case that 1400 it couldn't execute the file specified in the `exec' command. 1401 1402`nolinks' 1403 If present, says not to follow symbolic links when doing commands 1404 that change the current working directory. By default, bash 1405 follows the logical chain of directories when performing commands 1406 such as `cd' which change the current directory. 1407 1408 For example, if `/usr/sys' is a link to `/usr/local/sys' then: 1409 $ cd /usr/sys; echo $PWD 1410 /usr/sys 1411 $ cd ..; pwd 1412 /usr 1413 1414 If `nolinks' exists, then: 1415 $ cd /usr/sys; echo $PWD 1416 /usr/local/sys 1417 $ cd ..; pwd 1418 /usr/local 1419 1420 See also the description of the `-P' option to the `set' builtin, 1421 *Note The Set Builtin::. 1422 1423 1424File: features.info, Node: Shell Arithmetic, Next: Printing a Prompt, Prev: Bash Variables, Up: Bash Specific Features 1425 1426Shell Arithmetic 1427================ 1428 1429* Menu: 1430 1431* Arithmetic Evaluation:: How shell arithmetic works. 1432* Arithmetic Expansion:: How to use arithmetic in shell expansions. 1433* Arithmetic Builtins:: Builtin commands that use shell arithmetic. 1434 1435 1436File: features.info, Node: Arithmetic Evaluation, Next: Arithmetic Expansion, Up: Shell Arithmetic 1437 1438Arithmetic Evaluation 1439--------------------- 1440 1441 The shell allows arithmetic expressions to be evaluated, as one of 1442the shell expansions or by the `let' builtin. 1443 1444 Evaluation is done in long integers with no check for overflow, 1445though division by 0 is trapped and flagged as an error. The following 1446list of operators is grouped into levels of equal-precedence operators. 1447The levels are listed in order of decreasing precedence. 1448 1449`- +' 1450 unary minus and plus 1451 1452`! ~' 1453 logical and bitwise negation 1454 1455`* / %' 1456 multiplication, division, remainder 1457 1458`+ -' 1459 addition, subtraction 1460 1461`<< >>' 1462 left and right bitwise shifts 1463 1464`<= >= < >' 1465 comparison 1466 1467`== !=' 1468 equality and inequality 1469 1470`&' 1471 bitwise AND 1472 1473`^' 1474 bitwise exclusive OR 1475 1476`|' 1477 bitwise OR 1478 1479`&&' 1480 logical AND 1481 1482`||' 1483 logical OR 1484 1485`= *= /= %= += -= <<= >>= &= ^= |=' 1486 assignment 1487 1488 Shell variables are allowed as operands; parameter expansion is 1489performed before the expression is evaluated. The value of a parameter 1490is coerced to a long integer within an expression. A shell variable 1491need not have its integer attribute turned on to be used in an 1492expression. 1493 1494 Constants with a leading 0 are interpreted as octal numbers. A 1495leading `0x' or `0X' denotes hexadecimal. Otherwise, numbers take the 1496form [BASE#]n, where BASE is a decimal number between 2 and 36 1497representing the arithmetic base, and N is a number in that base. If 1498BASE is omitted, then base 10 is used. 1499 1500 Operators are evaluated in order of precedence. Sub-expressions in 1501parentheses are evaluated first and may override the precedence rules 1502above. 1503 1504 1505File: features.info, Node: Arithmetic Expansion, Next: Arithmetic Builtins, Prev: Arithmetic Evaluation, Up: Shell Arithmetic 1506 1507Arithmetic Expansion 1508-------------------- 1509 1510 Arithmetic expansion allows the evaluation of an arithmetic 1511expression and the substitution of the result. There are two formats 1512for arithmetic expansion: 1513 1514 $[ expression ] 1515 $(( expression )) 1516 1517 The expression is treated as if it were within double quotes, but a 1518double quote inside the braces or parentheses is not treated specially. 1519All tokens in the expression undergo parameter expansion, command 1520substitution, and quote removal. Arithmetic substitutions may be 1521nested. 1522 1523 The evaluation is performed according to the rules listed above. If 1524the expression is invalid, Bash prints a message indicating failure and 1525no substitution occurs. 1526 1527 1528File: features.info, Node: Arithmetic Builtins, Prev: Arithmetic Expansion, Up: Shell Arithmetic 1529 1530Arithmetic Builtins 1531------------------- 1532 1533`let' 1534 let EXPRESSION [EXPRESSION] 1535 The `let' builtin allows arithmetic to be performed on shell 1536 variables. Each EXPRESSION is evaluated according to the rules 1537 given previously (*note Arithmetic Evaluation::.). If the last 1538 EXPRESSION evaluates to 0, `let' returns 1; otherwise 0 is 1539 returned. 1540 1541 1542File: features.info, Node: Printing a Prompt, Prev: Shell Arithmetic, Up: Bash Specific Features 1543 1544Controlling the Prompt 1545====================== 1546 1547 The value of the variable `$PROMPT_COMMAND' is examined just before 1548Bash prints each primary prompt. If it is set and non-null, then the 1549value is executed just as if you had typed it on the command line. 1550 1551 In addition, the following table describes the special characters 1552which can appear in the `PS1' variable: 1553 1554`\t' 1555 the time, in HH:MM:SS format. 1556 1557`\d' 1558 the date, in "Weekday Month Date" format (e.g. "Tue May 26"). 1559 1560`\n' 1561 newline. 1562 1563`\s' 1564 the name of the shell, the basename of `$0' (the portion following 1565 the final slash). 1566 1567`\w' 1568 the current working directory. 1569 1570`\W' 1571 the basename of `$PWD'. 1572 1573`\u' 1574 your username. 1575 1576`\h' 1577 the hostname. 1578 1579`\#' 1580 the command number of this command. 1581 1582`\!' 1583 the history number of this command. 1584 1585`\nnn' 1586 the character corresponding to the octal number `nnn'. 1587 1588`\$' 1589 if the effective uid is 0, `#', otherwise `$'. 1590 1591`\\' 1592 a backslash. 1593 1594`\[' 1595 begin a sequence of non-printing characters. This could be used to 1596 embed a terminal control sequence into the prompt. 1597 1598`\]' 1599 end a sequence of non-printing characters. 1600 1601 1602File: features.info, Node: Job Control, Next: Using History Interactively, Prev: Bash Specific Features, Up: Top 1603 1604Job Control 1605*********** 1606 1607 This chapter disusses what job control is, how it works, and how 1608Bash allows you to access its facilities. 1609 1610* Menu: 1611 1612* Job Control Basics:: How job control works. 1613* Job Control Builtins:: Bash builtin commands used to interact 1614 with job control. 1615* Job Control Variables:: Variables Bash uses to customize job 1616 control. 1617 1618 1619File: features.info, Node: Job Control Basics, Next: Job Control Builtins, Up: Job Control 1620 1621Job Control Basics 1622================== 1623 1624 Job control refers to the ability to selectively stop (suspend) the 1625execution of processes and continue (resume) their execution at a later 1626point. A user typically employs this facility via an interactive 1627interface supplied jointly by the system's terminal driver and Bash. 1628 1629 The shell associates a JOB with each pipeline. It keeps a table of 1630currently executing jobs, which may be listed with the `jobs' command. 1631When Bash starts a job asynchronously (in the background), it prints a 1632line that looks like: 1633 [1] 25647 1634 indicating that this job is job number 1 and that the process ID of 1635the last process in the pipeline associated with this job is 25647. 1636All of the processes in a single pipeline are members of the same job. 1637Bash uses the JOB abstraction as the basis for job control. 1638 1639 To facilitate the implementation of the user interface to job 1640control, the system maintains the notion of a current terminal process 1641group ID. Members of this process group (processes whose process group 1642ID is equal to the current terminal process group ID) receive 1643keyboard-generated signals such as `SIGINT'. These processes are said 1644to be in the foreground. Background processes are those whose process 1645group ID differs from the terminal's; such processes are immune to 1646keyboard-generated signals. Only foreground processes are allowed to 1647read from or write to the terminal. Background processes which attempt 1648to read from (write to) the terminal are sent a `SIGTTIN' (`SIGTTOU') 1649signal by the terminal driver, which, unless caught, suspends the 1650process. 1651 1652 If the operating system on which Bash is running supports job 1653control, Bash allows you to use it. Typing the SUSPEND character 1654(typically `^Z', Control-Z) while a process is running causes that 1655process to be stopped and returns you to Bash. Typing the DELAYED 1656SUSPEND character (typically `^Y', Control-Y) causes the process to be 1657stopped when it attempts to read input from the terminal, and control to 1658be returned to Bash. You may then manipulate the state of this job, 1659using the `bg' command to continue it in the background, the `fg' 1660command to continue it in the foreground, or the `kill' command to kill 1661it. A `^Z' takes effect immediately, and has the additional side 1662effect of causing pending output and typeahead to be discarded. 1663 1664 There are a number of ways to refer to a job in the shell. The 1665character `%' introduces a job name. Job number `n' may be referred to 1666as `%n'. A job may also be referred to using a prefix of the name used 1667to start it, or using a substring that appears in its command line. 1668For example, `%ce' refers to a stopped `ce' job. Using `%?ce', on the 1669other hand, refers to any job containing the string `ce' in its command 1670line. If the prefix or substring matches more than one job, Bash 1671reports an error. The symbols `%%' and `%+' refer to the shell's 1672notion of the current job, which is the last job stopped while it was 1673in the foreground. The previous job may be referenced using `%-'. In 1674output pertaining to jobs (e.g., the output of the `jobs' command), the 1675current job is always flagged with a `+', and the previous job with a 1676`-'. 1677 1678 Simply naming a job can be used to bring it into the foreground: 1679`%1' is a synonym for `fg %1' bringing job 1 from the background into 1680the foreground. Similarly, `%1 &' resumes job 1 in the background, 1681equivalent to `bg %1' 1682 1683 The shell learns immediately whenever a job changes state. 1684Normally, Bash waits until it is about to print a prompt before 1685reporting changes in a job's status so as to not interrupt any other 1686output. If the the `-b' option to the `set' builtin is set, Bash 1687reports such changes immediately (*note The Set Builtin::.). This 1688feature is also controlled by the variable `notify'. 1689 1690 If you attempt to exit bash while jobs are stopped, the shell prints 1691a message warning you. You may then use the `jobs' command to inspect 1692their status. If you do this, or try to exit again immediately, you 1693are not warned again, and the stopped jobs are terminated. 1694 1695 1696File: features.info, Node: Job Control Builtins, Next: Job Control Variables, Prev: Job Control Basics, Up: Job Control 1697 1698Job Control Builtins 1699==================== 1700 1701`bg' 1702 bg [JOBSPEC] 1703 Place JOBSPEC into the background, as if it had been started with 1704 `&'. If JOBSPEC is not supplied, the current job is used. 1705 1706`fg' 1707 fg [JOBSPEC] 1708 Bring JOBSPEC into the foreground and make it the current job. If 1709 JOBSPEC is not supplied, the current job is used. 1710 1711`jobs' 1712 jobs [-lpn] [JOBSPEC] 1713 jobs -x COMMAND [JOBSPEC] 1714 1715 The first form lists the active jobs. The `-l' option lists 1716 process IDs in addition to the normal information; the `-p' option 1717 lists only the process ID of the job's process group leader. The 1718 `-n' option displays only jobs that have changed status since last 1719 notfied. If JOBSPEC is given, output is restricted to information 1720 about that job. If JOBSPEC is not supplied, the status of all 1721 jobs is listed. 1722 1723 If the `-x' option is supplied, `jobs' replaces any JOBSPEC found 1724 in COMMAND or ARGUMENTS with the corresponding process group ID, 1725 and executes COMMAND, passing it ARGUMENTs, returning its exit 1726 status. 1727 1728`suspend' 1729 suspend [-f] 1730 Suspend the execution of this shell until it receives a `SIGCONT' 1731 signal. The `-f' option means to suspend even if the shell is a 1732 login shell. 1733 1734 When job control is active, the `kill' and `wait' builtins also 1735accept JOBSPEC arguments. 1736 1737 1738File: features.info, Node: Job Control Variables, Prev: Job Control Builtins, Up: Job Control 1739 1740Job Control Variables 1741===================== 1742 1743`auto_resume' 1744 This variable controls how the shell interacts with the user and 1745 job control. If this variable exists then single word simple 1746 commands without redirects are treated as candidates for resumption 1747 of an existing job. There is no ambiguity allowed; if you have 1748 more than one job beginning with the string that you have typed, 1749 then the most recently accessed job will be selected. The name of 1750 a stopped job, in this context, is the command line used to start 1751 it. If this variable is set to the value `exact', the string 1752 supplied must match the name of a stopped job exactly; if set to 1753 `substring', the string supplied needs to match a substring of the 1754 name of a stopped job. The `substring' value provides 1755 functionality analogous to the `%?' job id (*note Job Control 1756 Basics::.). If set to any other value, the supplied string must 1757 be a prefix of a stopped job's name; this provides functionality 1758 analogous to the `%' job id. 1759 1760`notify' 1761 Setting this variable to a value is equivalent to `set -b'; 1762 unsetting it is equivalent to `set +b' (*note The Set Builtin::.). 1763 1764 1765File: features.info, Node: Using History Interactively, Next: Command Line Editing, Prev: Job Control, Up: Top 1766 1767Using History Interactively 1768*************************** 1769 1770 This chapter describes how to use the GNU History Library 1771interactively, from a user's standpoint. It should be considered a 1772user's guide. For information on using the GNU History Library in your 1773own programs, see the GNU Readline Library Manual. 1774 1775* Menu: 1776 1777* History Interaction:: What it feels like using History as a user. 1778 1779 1780File: features.info, Node: History Interaction, Up: Using History Interactively 1781 1782History Interaction 1783=================== 1784 1785 The History library provides a history expansion feature that is 1786similar to the history expansion in `csh'. The following text describes 1787the syntax used to manipulate the history information. 1788 1789 History expansion takes place in two parts. The first is to 1790determine which line from the previous history should be used during 1791substitution. The second is to select portions of that line for 1792inclusion into the current one. The line selected from the previous 1793history is called the "event", and the portions of that line that are 1794acted upon are called "words". The line is broken into words in the 1795same fashion that Bash does, so that several English (or Unix) words 1796surrounded by quotes are considered as one word. 1797 1798* Menu: 1799 1800* Event Designators:: How to specify which history line to use. 1801* Word Designators:: Specifying which words are of interest. 1802* Modifiers:: Modifying the results of substitution. 1803 1804 1805File: features.info, Node: Event Designators, Next: Word Designators, Up: History Interaction 1806 1807Event Designators 1808----------------- 1809 1810 An event designator is a reference to a command line entry in the 1811history list. 1812 1813`!' 1814 Start a history substitution, except when followed by a space, tab, 1815 the end of the line, = or (. 1816 1817`!!' 1818 Refer to the previous command. This is a synonym for `!-1'. 1819 1820`!n' 1821 Refer to command line N. 1822 1823`!-n' 1824 Refer to the command line N lines back. 1825 1826`!string' 1827 Refer to the most recent command starting with STRING. 1828 1829`!?string'[`?'] 1830 Refer to the most recent command containing STRING. 1831 1832`!#' 1833 The entire command line typed so far. 1834 1835`^string1^string2^' 1836 Quick Substitution. Repeat the last command, replacing STRING1 1837 with STRING2. Equivalent to `!!:s/string1/string2/'. 1838 1839 1840File: features.info, Node: Word Designators, Next: Modifiers, Prev: Event Designators, Up: History Interaction 1841 1842Word Designators 1843---------------- 1844 1845 A : separates the event specification from the word designator. It 1846can be omitted if the word designator begins with a ^, $, * or %. 1847Words are numbered from the beginning of the line, with the first word 1848being denoted by a 0 (zero). 1849 1850`0 (zero)' 1851 The `0'th word. For many applications, this is the command word. 1852 1853`n' 1854 The Nth word. 1855 1856`^' 1857 The first argument; that is, word 1. 1858 1859`$' 1860 The last argument. 1861 1862`%' 1863 The word matched by the most recent `?string?' search. 1864 1865`x-y' 1866 A range of words; `-Y' abbreviates `0-Y'. 1867 1868`*' 1869 All of the words, except the `0'th. This is a synonym for `1-$'. 1870 It is not an error to use * if there is just one word in the event; 1871 the empty string is returned in that case. 1872 1873`x*' 1874 Abbreviates `x-$' 1875 1876`x-' 1877 Abbreviates `x-$' like `x*', but omits the last word. 1878 1879 1880File: features.info, Node: Modifiers, Prev: Word Designators, Up: History Interaction 1881 1882Modifiers 1883--------- 1884 1885 After the optional word designator, you can add a sequence of one or 1886more of the following modifiers, each preceded by a :. 1887 1888`h' 1889 Remove a trailing pathname component, leaving only the head. 1890 1891`r' 1892 Remove a trailing suffix of the form `.'SUFFIX, leaving the 1893 basename. 1894 1895`e' 1896 Remove all but the trailing suffix. 1897 1898`t' 1899 Remove all leading pathname components, leaving the tail. 1900 1901`p' 1902 Print the new command but do not execute it. 1903 1904`q' 1905 Quote the substituted words, escaping further substitutions. 1906 1907`x' 1908 Quote the substituted words as with `q', but break into words at 1909 spaces, tabs, and newlines. 1910 1911`s/old/new/' 1912 Substitute NEW for the first occurrence of OLD in the event line. 1913 Any delimiter may be used in place of /. The delimiter may be 1914 quoted in OLD and NEW with a single backslash. If & appears in 1915 NEW, it is replaced by OLD. A single backslash will quote the &. 1916 The final delimiter is optional if it is the last character on the 1917 input line. 1918 1919`&' 1920 Repeat the previous substitution. 1921 1922`g' 1923 Cause changes to be applied over the entire event line. Used in 1924 conjunction with `s', as in `gs/old/new/', or with `&'. 1925 1926 1927File: features.info, Node: Command Line Editing, Next: Variable Index, Prev: Using History Interactively, Up: Top 1928 1929Command Line Editing 1930******************** 1931 1932 This chapter describes the basic features of the GNU command line 1933editing interface. 1934 1935* Menu: 1936 1937* Introduction and Notation:: Notation used in this text. 1938* Readline Interaction:: The minimum set of commands for editing a line. 1939* Readline Init File:: Customizing Readline from a user's view. 1940* Bindable Readline Commands:: A description of most of the Readline commands 1941 available for binding 1942* Readline vi Mode:: A short description of how to make Readline 1943 behave line the vi editor. 1944 1945 1946File: features.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing 1947 1948Introduction to Line Editing 1949============================ 1950 1951 The following paragraphs describe the notation used to represent 1952keystrokes. 1953 1954 The text C-k is read as `Control-K' and describes the character 1955produced when the Control key is depressed and the k key is struck. 1956 1957 The text M-k is read as `Meta-K' and describes the character 1958produced when the meta key (if you have one) is depressed, and the k 1959key is struck. If you do not have a meta key, the identical keystroke 1960can be generated by typing ESC first, and then typing k. Either 1961process is known as "metafying" the k key. 1962 1963 The text M-C-k is read as `Meta-Control-k' and describes the 1964character produced by "metafying" C-k. 1965 1966 In addition, several keys have their own names. Specifically, DEL, 1967ESC, LFD, SPC, RET, and TAB all stand for themselves when seen in this 1968text, or in an init file (*note Readline Init File::., for more info). 1969 1970 1971File: features.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing 1972 1973Readline Interaction 1974==================== 1975 1976 Often during an interactive session you type in a long line of text, 1977only to notice that the first word on the line is misspelled. The 1978Readline library gives you a set of commands for manipulating the text 1979as you type it in, allowing you to just fix your typo, and not forcing 1980you to retype the majority of the line. Using these editing commands, 1981you move the cursor to the place that needs correction, and delete or 1982insert the text of the corrections. Then, when you are satisfied with 1983the line, you simply press RETURN. You do not have to be at the end of 1984the line to press RETURN; the entire line is accepted regardless of the 1985location of the cursor within the line. 1986 1987* Menu: 1988 1989* Readline Bare Essentials:: The least you need to know about Readline. 1990* Readline Movement Commands:: Moving about the input line. 1991* Readline Killing Commands:: How to delete text, and how to get it back! 1992* Readline Arguments:: Giving numeric arguments to commands. 1993 1994 1995File: features.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction 1996 1997Readline Bare Essentials 1998------------------------ 1999 2000 In order to enter characters into the line, simply type them. The 2001typed character appears where the cursor was, and then the cursor moves 2002one space to the right. If you mistype a character, you can use your 2003erase character to back up and delete the mistyped character. 2004 2005 Sometimes you may miss typing a character that you wanted to type, 2006and not notice your error until you have typed several other 2007characters. In that case, you can type C-b to move the cursor to the 2008left, and then correct your mistake. Afterwards, you can move the 2009cursor to the right with C-f. 2010 2011 When you add text in the middle of a line, you will notice that 2012characters to the right of the cursor are `pushed over' to make room 2013for the text that you have inserted. Likewise, when you delete text 2014behind the cursor, characters to the right of the cursor are `pulled 2015back' to fill in the blank space created by the removal of the text. A 2016list of the basic bare essentials for editing the text of an input line 2017follows. 2018 2019C-b 2020 Move back one character. 2021 2022C-f 2023 Move forward one character. 2024 2025DEL 2026 Delete the character to the left of the cursor. 2027 2028C-d 2029 Delete the character underneath the cursor. 2030 2031Printing characters 2032 Insert the character into the line at the cursor. 2033 2034C-_ 2035 Undo the last thing that you did. You can undo all the way back 2036 to an empty line. 2037 2038 2039File: features.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction 2040 2041Readline Movement Commands 2042-------------------------- 2043 2044 The above table describes the most basic possible keystrokes that 2045you need in order to do editing of the input line. For your 2046convenience, many other commands have been added in addition to C-b, 2047C-f, C-d, and DEL. Here are some commands for moving more rapidly 2048about the line. 2049 2050C-a 2051 Move to the start of the line. 2052 2053C-e 2054 Move to the end of the line. 2055 2056M-f 2057 Move forward a word. 2058 2059M-b 2060 Move backward a word. 2061 2062C-l 2063 Clear the screen, reprinting the current line at the top. 2064 2065 Notice how C-f moves forward a character, while M-f moves forward a 2066word. It is a loose convention that control keystrokes operate on 2067characters while meta keystrokes operate on words. 2068 2069 2070File: features.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction 2071 2072Readline Killing Commands 2073------------------------- 2074 2075 "Killing" text means to delete the text from the line, but to save 2076it away for later use, usually by "yanking" (re-inserting) it back into 2077the line. If the description for a command says that it `kills' text, 2078then you can be sure that you can get the text back in a different (or 2079the same) place later. 2080 2081 When you use a kill command, the text is saved in a "kill-ring". 2082Any number of consecutive kills save all of the killed text together, so 2083that when you yank it back, you get it all. The kill ring is not line 2084specific; the text that you killed on a previously typed line is 2085available to be yanked back later, when you are typing another line. 2086 2087 Here is the list of commands for killing text. 2088 2089C-k 2090 Kill the text from the current cursor position to the end of the 2091 line. 2092 2093M-d 2094 Kill from the cursor to the end of the current word, or if between 2095 words, to the end of the next word. 2096 2097M-DEL 2098 Kill from the cursor the start of the previous word, or if between 2099 words, to the start of the previous word. 2100 2101C-w 2102 Kill from the cursor to the previous whitespace. This is 2103 different than M-DEL because the word boundaries differ. 2104 2105 And, here is how to "yank" the text back into the line. Yanking 2106means to copy the most-recently-killed text from the kill buffer. 2107 2108C-y 2109 Yank the most recently killed text back into the buffer at the 2110 cursor. 2111 2112M-y 2113 Rotate the kill-ring, and yank the new top. You can only do this 2114 if the prior command is C-y or M-y. 2115 2116 2117File: features.info, Node: Readline Arguments, Prev: Readline Killing Commands, Up: Readline Interaction 2118 2119Readline Arguments 2120------------------ 2121 2122 You can pass numeric arguments to Readline commands. Sometimes the 2123argument acts as a repeat count, other times it is the sign of the 2124argument that is significant. If you pass a negative argument to a 2125command which normally acts in a forward direction, that command will 2126act in a backward direction. For example, to kill text back to the 2127start of the line, you might type M- C-k. 2128 2129 The general way to pass numeric arguments to a command is to type 2130meta digits before the command. If the first `digit' you type is a 2131minus sign (-), then the sign of the argument will be negative. Once 2132you have typed one meta digit to get the argument started, you can type 2133the remainder of the digits, and then the command. For example, to give 2134the C-d command an argument of 10, you could type M-1 0 C-d. 2135 2136 2137File: features.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing 2138 2139Readline Init File 2140================== 2141 2142 Although the Readline library comes with a set of Emacs-like 2143keybindings installed by default, it is possible that you would like to 2144use a different set of keybindings. You can customize programs that 2145use Readline by putting commands in an "init" file in your home 2146directory. The name of this file is taken from the value of the shell 2147variable `INPUTRC'. If that variable is unset, the default is 2148`~/.inputrc'. 2149 2150 When a program which uses the Readline library starts up, the init 2151file is read, and the key bindings are set. 2152 2153 In addition, the `C-x C-r' command re-reads this init file, thus 2154incorporating any changes that you might have made to it. 2155 2156* Menu: 2157 2158* Readline Init Syntax:: Syntax for the commands in the inputrc file. 2159* Conditional Init Constructs:: Conditional key bindings in the inputrc file. 2160 2161 2162File: features.info, Node: Readline Init Syntax, Next: Conditional Init Constructs, Up: Readline Init File 2163 2164Readline Init Syntax 2165-------------------- 2166 2167 There are only a few basic constructs allowed in the Readline init 2168file. Blank lines are ignored. Lines beginning with a # are comments. 2169Lines beginning with a $ indicate conditional constructs (*note 2170Conditional Init Constructs::.). Other lines denote variable settings 2171and key bindings. 2172 2173Variable Settings 2174 You can change the state of a few variables in Readline by using 2175 the `set' command within the init file. Here is how you would 2176 specify that you wish to use `vi' line editing commands: 2177 2178 set editing-mode vi 2179 2180 Right now, there are only a few variables which can be set; so 2181 few, in fact, that we just list them here: 2182 2183 `editing-mode' 2184 The `editing-mode' variable controls which editing mode you 2185 are using. By default, Readline starts up in Emacs editing 2186 mode, where the keystrokes are most similar to Emacs. This 2187 variable can be set to either `emacs' or `vi'. 2188 2189 `horizontal-scroll-mode' 2190 This variable can be set to either `On' or `Off'. Setting it 2191 to `On' means that the text of the lines that you edit will 2192 scroll horizontally on a single screen line when they are 2193 longer than the width of the screen, instead of wrapping onto 2194 a new screen line. By default, this variable is set to `Off'. 2195 2196 `mark-modified-lines' 2197 This variable, when set to `On', says to display an asterisk 2198 (`*') at the start of history lines which have been modified. 2199 This variable is `off' by default. 2200 2201 `bell-style' 2202 Controls what happens when Readline wants to ring the 2203 terminal bell. If set to `none', Readline never rings the 2204 bell. If set to `visible', Readline uses a visible bell if 2205 one is available. If set to `audible' (the default), 2206 Readline attempts to ring the terminal's bell. 2207 2208 `comment-begin' 2209 The string to insert at the beginning of the line when the 2210 `vi-comment' command is executed. The default value is `"#"'. 2211 2212 `meta-flag' 2213 If set to `on', Readline will enable eight-bit input (it will 2214 not strip the eighth bit from the characters it reads), 2215 regardless of what the terminal claims it can support. The 2216 default value is `off'. 2217 2218 `convert-meta' 2219 If set to `on', Readline will convert characters with the 2220 eigth bit set to an ASCII key sequence by stripping the eigth 2221 bit and prepending an ESC character, converting them to a 2222 meta-prefixed key sequence. The default value is `on'. 2223 2224 `output-meta' 2225 If set to `on', Readline will display characters with the 2226 eighth bit set directly rather than as a meta-prefixed escape 2227 sequence. The default is `off'. 2228 2229 `completion-query-items' 2230 The number of possible completions that determines when the 2231 user is asked whether he wants to see the list of 2232 possibilities. If the number of possible completions is 2233 greater than this value, Readline will ask the user whether 2234 or not he wishes to view them; otherwise, they are simply 2235 listed. The default limit is `100'. 2236 2237 `keymap' 2238 Sets Readline's idea of the current keymap for key binding 2239 commands. Acceptable `keymap' names are `emacs', 2240 `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move', 2241 `vi-command', and `vi-insert'. `vi' is equivalent to 2242 `vi-command'; `emacs' is equivalent to `emacs-standard'. The 2243 default value is `emacs'. The value of the `editing-mode' 2244 variable also affects the default keymap. 2245 2246 `show-all-if-ambiguous' 2247 This alters the default behavior of the completion functions. 2248 If set to `on', words which have more than one possible 2249 completion cause the matches to be listed immediately instead 2250 of ringing the bell. The default value is `off'. 2251 2252 `expand-tilde' 2253 If set to `on', tilde expansion is performed when Readline 2254 attempts word completion. The default is `off'. 2255 2256Key Bindings 2257 The syntax for controlling key bindings in the init file is 2258 simple. First you have to know the name of the command that you 2259 want to change. The following pages contain tables of the command 2260 name, the default keybinding, and a short description of what the 2261 command does. 2262 2263 Once you know the name of the command, simply place the name of 2264 the key you wish to bind the command to, a colon, and then the 2265 name of the command on a line in the init file. The name of the 2266 key can be expressed in different ways, depending on which is most 2267 comfortable for you. 2268 2269 KEYNAME: FUNCTION-NAME or MACRO 2270 KEYNAME is the name of a key spelled out in English. For 2271 example: 2272 Control-u: universal-argument 2273 Meta-Rubout: backward-kill-word 2274 Control-o: ">&output" 2275 2276 In the above example, `C-u' is bound to the function 2277 `universal-argument', and `C-o' is bound to run the macro 2278 expressed on the right hand side (that is, to insert the text 2279 `>&output' into the line). 2280 2281 "KEYSEQ": FUNCTION-NAME or MACRO 2282 KEYSEQ differs from KEYNAME above in that strings denoting an 2283 entire key sequence can be specified, by placing the key 2284 sequence in double quotes. Some GNU Emacs style key escapes 2285 can be used, as in the following example, but the special 2286 character names are not recognized. 2287 2288 "\C-u": universal-argument 2289 "\C-x\C-r": re-read-init-file 2290 "\e[11~": "Function Key 1" 2291 2292 In the above example, `C-u' is bound to the function 2293 `universal-argument' (just as it was in the first example), 2294 `C-x C-r' is bound to the function `re-read-init-file', and 2295 `ESC [ 1 1 ~' is bound to insert the text `Function Key 1'. 2296 The following escape sequences are available when specifying 2297 key sequences: 2298 2299 ``\C-'' 2300 control prefix 2301 2302 ``\M-'' 2303 meta prefix 2304 2305 ``\e'' 2306 an escape character 2307 2308 ``\\'' 2309 backslash 2310 2311 ``\"'' 2312 " 2313 2314 ``\''' 2315 ' 2316 2317 When entering the text of a macro, single or double quotes 2318 should be used to indicate a macro definition. Unquoted text 2319 is assumed to be a function name. Backslash will quote any 2320 character in the macro text, including " and '. For example, 2321 the following binding will make `C-x \' insert a single \ 2322 into the line: 2323 "\C-x\\": "\\" 2324 2325 2326File: features.info, Node: Conditional Init Constructs, Prev: Readline Init Syntax, Up: Readline Init File 2327 2328Conditional Init Constructs 2329--------------------------- 2330 2331 Readline implements a facility similar in spirit to the conditional 2332compilation features of the C preprocessor which allows key bindings 2333and variable settings to be performed as the result of tests. There 2334are three parser directives used. 2335 2336`$if' 2337 The `$if' construct allows bindings to be made based on the 2338 editing mode, the terminal being used, or the application using 2339 Readline. The text of the test extends to the end of the line; no 2340 characters are required to isolate it. 2341 2342 `mode' 2343 The `mode=' form of the `$if' directive is used to test 2344 whether Readline is in `emacs' or `vi' mode. This may be 2345 used in conjunction with the `set keymap' command, for 2346 instance, to set bindings in the `emacs-standard' and 2347 `emacs-ctlx' keymaps only if Readline is starting out in 2348 `emacs' mode. 2349 2350 `term' 2351 The `term=' form may be used to include terminal-specific key 2352 bindings, perhaps to bind the key sequences output by the 2353 terminal's function keys. The word on the right side of the 2354 `=' is tested against the full name of the terminal and the 2355 portion of the terminal name before the first `-'. This 2356 allows SUN to match both SUN and SUN-CMD, for instance. 2357 2358 `application' 2359 The APPLICATION construct is used to include 2360 application-specific settings. Each program using the 2361 Readline library sets the APPLICATION NAME, and you can test 2362 for it. This could be used to bind key sequences to 2363 functions useful for a specific program. For instance, the 2364 following command adds a key sequence that quotes the current 2365 or previous word in Bash: 2366 $if bash 2367 # Quote the current or previous word 2368 "\C-xq": "\eb\"\ef\"" 2369 $endif 2370 2371`$endif' 2372 This command, as you saw in the previous example, terminates an 2373 `$if' command. 2374 2375`$else' 2376 Commands in this branch of the `$if' directive are executed if the 2377 test fails. 2378 2379 2380File: features.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing 2381 2382Bindable Readline Commands 2383========================== 2384 2385* Menu: 2386 2387* Commands For Moving:: Moving about the line. 2388* Commands For History:: Getting at previous lines. 2389* Commands For Text:: Commands for changing text. 2390* Commands For Killing:: Commands for killing and yanking. 2391* Numeric Arguments:: Specifying numeric arguments, repeat counts. 2392* Commands For Completion:: Getting Readline to do the typing for you. 2393* Keyboard Macros:: Saving and re-executing typed characters 2394* Miscellaneous Commands:: Other miscellaneous commands. 2395 2396 2397File: features.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands 2398 2399Commands For Moving 2400------------------- 2401 2402`beginning-of-line (C-a)' 2403 Move to the start of the current line. 2404 2405`end-of-line (C-e)' 2406 Move to the end of the line. 2407 2408`forward-char (C-f)' 2409 Move forward a character. 2410 2411`backward-char (C-b)' 2412 Move back a character. 2413 2414`forward-word (M-f)' 2415 Move forward to the end of the next word. Words are composed of 2416 letters and digits. 2417 2418`backward-word (M-b)' 2419 Move back to the start of this, or the previous, word. Words are 2420 composed of letters and digits. 2421 2422`clear-screen (C-l)' 2423 Clear the screen and redraw the current line, leaving the current 2424 line at the top of the screen. 2425 2426`redraw-current-line ()' 2427 Refresh the current line. By default, this is unbound. 2428 2429 2430File: features.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands 2431 2432Commands For Manipulating The History 2433------------------------------------- 2434 2435`accept-line (Newline, Return)' 2436 Accept the line regardless of where the cursor is. If this line is 2437 non-empty, add it to the history list according to the setting of 2438 the `HISTCONTROL' variable. If this line was a history line, then 2439 restore the history line to its original state. 2440 2441`previous-history (C-p)' 2442 Move `up' through the history list. 2443 2444`next-history (C-n)' 2445 Move `down' through the history list. 2446 2447`beginning-of-history (M-<)' 2448 Move to the first line in the history. 2449 2450`end-of-history (M->)' 2451 Move to the end of the input history, i.e., the line you are 2452 entering. 2453 2454`reverse-search-history (C-r)' 2455 Search backward starting at the current line and moving `up' 2456 through the history as necessary. This is an incremental search. 2457 2458`forward-search-history (C-s)' 2459 Search forward starting at the current line and moving `down' 2460 through the the history as necessary. This is an incremental 2461 search. 2462 2463`non-incremental-reverse-search-history (M-p)' 2464 Search backward starting at the current line and moving `up' 2465 through the history as necessary using a non-incremental search 2466 for a string supplied by the user. 2467 2468`non-incremental-forward-search-history (M-n)' 2469 Search forward starting at the current line and moving `down' 2470 through the the history as necessary using a non-incremental search 2471 for a string supplied by the user. 2472 2473`history-search-forward ()' 2474 Search forward through the history for the string of characters 2475 between the start of the current line and the current point. This 2476 is a non-incremental search. By default, this command is unbound. 2477 2478`history-search-backward ()' 2479 Search backward through the history for the string of characters 2480 between the start of the current line and the current point. This 2481 is a non-incremental search. By default, this command is unbound. 2482 2483`yank-nth-arg (M-C-y)' 2484 Insert the first argument to the previous command (usually the 2485 second word on the previous line). With an argument N, insert the 2486 Nth word from the previous command (the words in the previous 2487 command begin with word 0). A negative argument inserts the Nth 2488 word from the end of the previous command. 2489 2490 2491File: features.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands 2492 2493Commands For Changing Text 2494-------------------------- 2495 2496`delete-char (C-d)' 2497 Delete the character under the cursor. If the cursor is at the 2498 beginning of the line, there are no characters in the line, and 2499 the last character typed was not C-d, then return EOF. 2500 2501`backward-delete-char (Rubout)' 2502 Delete the character behind the cursor. A numeric arg says to kill 2503 the characters instead of deleting them. 2504 2505`quoted-insert (C-q, C-v)' 2506 Add the next character that you type to the line verbatim. This is 2507 how to insert key sequences like C-q, for example. 2508 2509`tab-insert (M-TAB)' 2510 Insert a tab character. 2511 2512`self-insert (a, b, A, 1, !, ...)' 2513 Insert yourself. 2514 2515`transpose-chars (C-t)' 2516 Drag the character before the cursor forward over the character at 2517 the cursor, moving the cursor forward as well. If the insertion 2518 point is at the end of the line, then this transposes the last two 2519 characters of the line. Negative argumentss don't work. 2520 2521`transpose-words (M-t)' 2522 Drag the word behind the cursor past the word in front of the 2523 cursor moving the cursor over that word as well. 2524 2525`upcase-word (M-u)' 2526 Uppercase the current (or following) word. With a negative 2527 argument, do the previous word, but do not move the cursor. 2528 2529`downcase-word (M-l)' 2530 Lowercase the current (or following) word. With a negative 2531 argument, do the previous word, but do not move the cursor. 2532 2533`capitalize-word (M-c)' 2534 Capitalize the current (or following) word. With a negative 2535 argument, do the previous word, but do not move the cursor. 2536 2537 2538File: features.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands 2539 2540Killing And Yanking 2541------------------- 2542 2543`kill-line (C-k)' 2544 Kill the text from the current cursor position to the end of the 2545 line. 2546 2547`backward-kill-line (C-x Rubout)' 2548 Kill backward to the beginning of the line. 2549 2550`unix-line-discard (C-u)' 2551 Kill backward from the cursor to the beginning of the current line. 2552 Save the killed text on the kill-ring. 2553 2554`kill-whole-line ()' 2555 Kill all characters on the current line, no matter where the 2556 cursor is. By default, this is unbound. 2557 2558`kill-word (M-d)' 2559 Kill from the cursor to the end of the current word, or if between 2560 words, to the end of the next word. Word boundaries are the same 2561 as `forward-word'. 2562 2563`backward-kill-word (M-DEL)' 2564 Kill the word behind the cursor. Word boundaries are the same as 2565 `backward-word'. 2566 2567`unix-word-rubout (C-w)' 2568 Kill the word behind the cursor, using white space as a word 2569 boundary. The killed text is saved on the kill-ring. 2570 2571`delete-horizontal-space ()' 2572 Delete all spaces and tabs around point. By default, this is 2573 unbound. 2574 2575`yank (C-y)' 2576 Yank the top of the kill ring into the buffer at the current 2577 cursor position. 2578 2579`yank-pop (M-y)' 2580 Rotate the kill-ring, and yank the new top. You can only do this 2581 if the prior command is yank or yank-pop. 2582 2583 2584File: features.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands 2585 2586Specifying Numeric Arguments 2587---------------------------- 2588 2589`digit-argument (M-0, M-1, ... M--)' 2590 Add this digit to the argument already accumulating, or start a new 2591 argument. M- starts a negative argument. 2592 2593`universal-argument ()' 2594 Each time this is executed, the argument count is multiplied by 2595 four. The argument count is initially one, so executing this 2596 function the first time makes the argument count four. By 2597 default, this is not bound to a key. 2598 2599 2600File: features.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands 2601 2602Letting Readline Type For You 2603----------------------------- 2604 2605`complete (TAB)' 2606 Attempt to do completion on the text before the cursor. This is 2607 implementation defined. Generally, if you are typing a filename 2608 argument, you can do filename completion; if you are typing a 2609 command, you can do command completion, if you are typing in a 2610 symbol to GDB, you can do symbol name completion, if you are 2611 typing in a variable to Bash, you can do variable name completion, 2612 and so on. See the Bash manual page for a complete list of 2613 available completion functions. 2614 2615`possible-completions (M-?)' 2616 List the possible completions of the text before the cursor. 2617 2618`insert-completions ()' 2619 Insert all completions of the text before point that would have 2620 been generated by `possible-completions'. By default, this is not 2621 bound to a key. 2622 2623 2624File: features.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands 2625 2626Keyboard Macros 2627--------------- 2628 2629`start-kbd-macro (C-x ()' 2630 Begin saving the characters typed into the current keyboard macro. 2631 2632`end-kbd-macro (C-x ))' 2633 Stop saving the characters typed into the current keyboard macro 2634 and save the definition. 2635 2636`call-last-kbd-macro (C-x e)' 2637 Re-execute the last keyboard macro defined, by making the 2638 characters in the macro appear as if typed at the keyboard. 2639 2640 2641File: features.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands 2642 2643Some Miscellaneous Commands 2644--------------------------- 2645 2646`re-read-init-file (C-x C-r)' 2647 Read in the contents of your init file, and incorporate any 2648 bindings or variable assignments found there. 2649 2650`abort (C-g)' 2651 Abort the current editing command and ring the terminal's bell 2652 (subject to the setting of `bell-style'). 2653 2654`do-uppercase-version (M-a, M-b, ...)' 2655 Run the command that is bound to the corresoponding uppercase 2656 character. 2657 2658`prefix-meta (ESC)' 2659 Make the next character that you type be metafied. This is for 2660 people without a meta key. Typing `ESC f' is equivalent to typing 2661 `M-f'. 2662 2663`undo (C-_, C-x C-u)' 2664 Incremental undo, separately remembered for each line. 2665 2666`revert-line (M-r)' 2667 Undo all changes made to this line. This is like typing the `undo' 2668 command enough times to get back to the beginning. 2669 2670`tilde-expand (M-~)' 2671 Perform tilde expansion on the current word. 2672 2673`dump-functions ()' 2674 Print all of the functions and their key bindings to the readline 2675 output stream. If a numeric argument is supplied, the output is 2676 formatted in such a way that it can be made part of an INPUTRC 2677 file. 2678 2679`display-shell-version (C-x C-v)' 2680 Display version information about the current instance of Bash. 2681 2682`shell-expand-line (M-C-e)' 2683 Expand the line the way the shell does when it reads it. This 2684 performs alias and history expansion as well as all of the shell 2685 word expansions. 2686 2687`history-expand-line (M-^)' 2688 Perform history expansion on the current line. 2689 2690`insert-last-argument (M-., M-_)' 2691 Insert the last argument to the previous command (the last word on 2692 the previous line). With an argument N, insert the Nth word from 2693 the previous command (the words in the previous command begin with 2694 word 0). A negative argument inserts the Nth word from the end of 2695 the previous command. 2696 2697`operate-and-get-next (C-o)' 2698 Accept the current line for execution and fetch the next line 2699 relative to the current line from the history for editing. Any 2700 argument is ignored. 2701 2702`emacs-editing-mode (C-e)' 2703 When in `vi' editing mode, this causes a switch back to emacs 2704 editing mode, as if the command `set -o emacs' had been executed. 2705 2706 2707File: features.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing 2708 2709Readline vi Mode 2710================ 2711 2712 While the Readline library does not have a full set of `vi' editing 2713functions, it does contain enough to allow simple editing of the line. 2714The Readline `vi' mode behaves as specified in the Posix 1003.2 2715standard. 2716 2717 In order to switch interactively between `Emacs' and `Vi' editing 2718modes, use the `set -o emacs' and `set -o vi' commands (*note The Set 2719Builtin::.). The Readline default is `emacs' mode. 2720 2721 When you enter a line in `vi' mode, you are already placed in 2722`insertion' mode, as if you had typed an `i'. Pressing ESC switches 2723you into `command' mode, where you can edit the text of the line with 2724the standard `vi' movement keys, move to previous history lines with 2725`k', and following lines with `j', and so forth. 2726 2727 2728File: features.info, Node: Variable Index, Next: Concept Index, Prev: Command Line Editing, Up: Top 2729 2730Variable Index 2731************** 2732 2733* Menu: 2734 2735* auto_resume: Job Control Variables. 2736* BASH_VERSION: Bash Variables. 2737* bell-style: Readline Init Syntax. 2738* cdable_vars: C Shell Variables. 2739* CDPATH: Bourne Shell Variables. 2740* comment-begin: Readline Init Syntax. 2741* completion-query-items: Readline Init Syntax. 2742* convert-meta: Readline Init Syntax. 2743* editing-mode: Readline Init Syntax. 2744* EUID: Bash Variables. 2745* expand-tilde: Readline Init Syntax. 2746* FIGNORE: Bash Variables. 2747* histchars: Bash Variables. 2748* HISTCMD: Bash Variables. 2749* HISTCONTROL: Bash Variables. 2750* HISTFILE: Bash Variables. 2751* history_control: Bash Variables. 2752* HISTSIZE: Bash Variables. 2753* HOME: Bourne Shell Variables. 2754* horizontal-scroll-mode: Readline Init Syntax. 2755* HOSTFILE: Bash Variables. 2756* hostname_completion_file: Bash Variables. 2757* HOSTTYPE: Bash Variables. 2758* IFS: Bourne Shell Variables. 2759* IGNOREEOF: C Shell Variables. 2760* IGNOREEOF: Bash Variables. 2761* INPUTRC: Bash Variables. 2762* keymap: Readline Init Syntax. 2763* MAILCHECK: Bash Variables. 2764* MAILPATH: Bourne Shell Variables. 2765* mark-modified-lines: Readline Init Syntax. 2766* meta-flag: Readline Init Syntax. 2767* nolinks: Bash Variables. 2768* notify: Job Control Variables. 2769* no_exit_on_failed_exec: Bash Variables. 2770* OLDPWD: Korn Shell Variables. 2771* OPTARG: Bourne Shell Variables. 2772* OPTIND: Bourne Shell Variables. 2773* OSTYPE: Bash Variables. 2774* output-meta: Readline Init Syntax. 2775* PATH: Bourne Shell Variables. 2776* PROMPT_COMMAND: Bash Variables. 2777* PS1: Bourne Shell Variables. 2778* PS2: Bourne Shell Variables. 2779* PS3: Korn Shell Variables. 2780* PS4: Korn Shell Variables. 2781* PWD: Korn Shell Variables. 2782* RANDOM: Korn Shell Variables. 2783* REPLY: Korn Shell Variables. 2784* SECONDS: Korn Shell Variables. 2785* show-all-if-ambiguous: Readline Init Syntax. 2786* TMOUT: Korn Shell Variables. 2787* UID: Bash Variables. 2788 2789 2790File: features.info, Node: Concept Index, Prev: Variable Index, Up: Top 2791 2792Concept Index 2793************* 2794 2795* Menu: 2796 2797* $else: Conditional Init Constructs. 2798* $endif: Conditional Init Constructs. 2799* $if: Conditional Init Constructs. 2800* .: Bourne Shell Builtins. 2801* :: Bourne Shell Builtins. 2802* abort (C-g): Miscellaneous Commands. 2803* accept-line (Newline, Return): Commands For History. 2804* alias: Alias Builtins. 2805* backward-char (C-b): Commands For Moving. 2806* backward-delete-char (Rubout): Commands For Text. 2807* backward-kill-line (C-x Rubout): Commands For Killing. 2808* backward-kill-word (M-DEL): Commands For Killing. 2809* backward-word (M-b): Commands For Moving. 2810* beginning-of-history (M-<): Commands For History. 2811* beginning-of-line (C-a): Commands For Moving. 2812* bg: Job Control Builtins. 2813* bind: Bash Builtins. 2814* break: Bourne Shell Builtins. 2815* builtin: Bash Builtins. 2816* call-last-kbd-macro (C-x e): Keyboard Macros. 2817* capitalize-word (M-c): Commands For Text. 2818* case: Conditional Constructs. 2819* cd: Bourne Shell Builtins. 2820* clear-screen (C-l): Commands For Moving. 2821* command: Bash Builtins. 2822* complete (TAB): Commands For Completion. 2823* continue: Bourne Shell Builtins. 2824* declare: Bash Builtins. 2825* delete-char (C-d): Commands For Text. 2826* delete-horizontal-space (): Commands For Killing. 2827* digit-argument (M-0, M-1, ... M-): Numeric Arguments. 2828* dirs: C Shell Builtins. 2829* do-uppercase-version (M-a, M-b, ...): Miscellaneous Commands. 2830* downcase-word (M-l): Commands For Text. 2831* dump-functions (): Miscellaneous Commands. 2832* echo: Bourne Shell Builtins. 2833* enable: Bash Builtins. 2834* end-kbd-macro (C-x )): Keyboard Macros. 2835* end-of-history (M->): Commands For History. 2836* end-of-line (C-e): Commands For Moving. 2837* eval: Bourne Shell Builtins. 2838* event designators: Event Designators. 2839* exec: Bourne Shell Builtins. 2840* exit: Bourne Shell Builtins. 2841* expansion: History Interaction. 2842* export: Bourne Shell Builtins. 2843* fc: Korn Shell Builtins. 2844* fg: Job Control Builtins. 2845* for: Looping Constructs. 2846* forward-char (C-f): Commands For Moving. 2847* forward-search-history (C-s): Commands For History. 2848* forward-word (M-f): Commands For Moving. 2849* getopts: Bourne Shell Builtins. 2850* hash: Bourne Shell Builtins. 2851* help: Bash Builtins. 2852* history: C Shell Builtins. 2853* History, how to use: Job Control Variables. 2854* history-search-backward (): Commands For History. 2855* history-search-forward (): Commands For History. 2856* if: Conditional Constructs. 2857* insert-completions (): Commands For Completion. 2858* interaction, readline: Readline Interaction. 2859* jobs: Job Control Builtins. 2860* kill: Bourne Shell Builtins. 2861* kill-line (C-k): Commands For Killing. 2862* kill-whole-line (): Commands For Killing. 2863* kill-word (M-d): Commands For Killing. 2864* let: Arithmetic Builtins. 2865* let: Korn Shell Builtins. 2866* local: Bash Builtins. 2867* logout: C Shell Builtins. 2868* next-history (C-n): Commands For History. 2869* non-incremental-forward-search-history (M-n): Commands For History. 2870* non-incremental-reverse-search-history (M-p): Commands For History. 2871* popd: C Shell Builtins. 2872* possible-completions (M-?): Commands For Completion. 2873* prefix-meta (ESC): Miscellaneous Commands. 2874* previous-history (C-p): Commands For History. 2875* pushd: C Shell Builtins. 2876* pwd: Bourne Shell Builtins. 2877* quoted-insert (C-q, C-v): Commands For Text. 2878* re-read-init-file (C-x C-r): Miscellaneous Commands. 2879* read: Bourne Shell Builtins. 2880* Readline, how to use: Modifiers. 2881* readonly: Bourne Shell Builtins. 2882* redraw-current-line (): Commands For Moving. 2883* return: Bourne Shell Builtins. 2884* reverse-search-history (C-r): Commands For History. 2885* revert-line (M-r): Miscellaneous Commands. 2886* self-insert (a, b, A, 1, !, ...): Commands For Text. 2887* set: The Set Builtin. 2888* shift: Bourne Shell Builtins. 2889* source: C Shell Builtins. 2890* start-kbd-macro (C-x (): Keyboard Macros. 2891* suspend: Job Control Builtins. 2892* tab-insert (M-TAB): Commands For Text. 2893* test: Bourne Shell Builtins. 2894* tilde-expand (M-~): Miscellaneous Commands. 2895* times: Bourne Shell Builtins. 2896* transpose-chars (C-t): Commands For Text. 2897* transpose-words (M-t): Commands For Text. 2898* trap: Bourne Shell Builtins. 2899* type: Bash Builtins. 2900* typeset: Korn Shell Builtins. 2901* ulimit: Bash Builtins. 2902* umask: Bourne Shell Builtins. 2903* unalias: Alias Builtins. 2904* undo (C-_, C-x C-u): Miscellaneous Commands. 2905* universal-argument (): Numeric Arguments. 2906* unix-line-discard (C-u): Commands For Killing. 2907* unix-word-rubout (C-w): Commands For Killing. 2908* unset: Bourne Shell Builtins. 2909* until: Looping Constructs. 2910* upcase-word (M-u): Commands For Text. 2911* wait: Bourne Shell Builtins. 2912* while: Looping Constructs. 2913* yank (C-y): Commands For Killing. 2914* yank-nth-arg (M-C-y): Commands For History. 2915* yank-pop (M-y): Commands For Killing. 2916* [: Bourne Shell Builtins. 2917 2918 2919 2920Tag Table: 2921Node: Top1042 2922Node: Bourne Shell Features2403 2923Node: Looping Constructs3577 2924Node: Conditional Constructs4632 2925Node: Shell Functions6192 2926Node: Bourne Shell Builtins7565 2927Node: Bourne Shell Variables9764 2928Node: Other Bourne Shell Features11023 2929Node: Major Differences from the Bourne Shell11781 2930Node: Csh Features14192 2931Node: Tilde Expansion15085 2932Node: Brace Expansion15689 2933Node: C Shell Builtins17281 2934Node: C Shell Variables20576 2935Node: Korn Shell Features21086 2936Node: Korn Shell Constructs21824 2937Node: Korn Shell Builtins23035 2938Node: Korn Shell Variables25188 2939Node: Aliases26464 2940Node: Alias Builtins28831 2941Node: Bash Specific Features29354 2942Node: Command Line Options30089 2943Node: Bash Startup Files31774 2944Node: Is This Shell Interactive?33624 2945Node: Bash Builtins34432 2946Node: The Set Builtin40814 2947Node: Bash Variables45754 2948Node: Shell Arithmetic50322 2949Node: Arithmetic Evaluation50684 2950Node: Arithmetic Expansion52405 2951Node: Arithmetic Builtins53239 2952Node: Printing a Prompt53711 2953Node: Job Control54976 2954Node: Job Control Basics55451 2955Node: Job Control Builtins59626 2956Node: Job Control Variables61145 2957Node: Using History Interactively62454 2958Node: History Interaction62961 2959Node: Event Designators63998 2960Node: Word Designators64834 2961Node: Modifiers65819 2962Node: Command Line Editing67128 2963Node: Introduction and Notation67788 2964Node: Readline Interaction68808 2965Node: Readline Bare Essentials69947 2966Node: Readline Movement Commands71477 2967Node: Readline Killing Commands72368 2968Node: Readline Arguments74071 2969Node: Readline Init File75022 2970Node: Readline Init Syntax76020 2971Node: Conditional Init Constructs82953 2972Node: Bindable Readline Commands85199 2973Node: Commands For Moving85869 2974Node: Commands For History86717 2975Node: Commands For Text89180 2976Node: Commands For Killing90919 2977Node: Numeric Arguments92368 2978Node: Commands For Completion92995 2979Node: Keyboard Macros94010 2980Node: Miscellaneous Commands94569 2981Node: Readline vi Mode96938 2982Node: Variable Index97815 2983Node: Concept Index101143 2984 2985End Tag Table 2986