/usr/bin/bash: Difference between revisions

Line 1,601: Line 1,601:


=== Commands for Manipulating the History ===
=== Commands for Manipulating the History ===
      accept-line (Newline, Return)
;accept-line (Newline, Return)
              Accept  the  line regardless of where the cursor is.  If this line is non-empty, add it to
:Accept  the  line regardless of where the cursor is.  If this line is non-empty, add it to the history list according to the state of the HISTCONTROL variable.  If  the  line  is  a modified history line, then restore the history line to its original state.
              the history list according to the state of the HISTCONTROL variable.  If  the  line  is  a
;previous-history (C-p)
              modified history line, then restore the history line to its original state.
:Fetch the previous command from the history list, moving back in the list.
      previous-history (C-p)
;next-history (C-n)
              Fetch the previous command from the history list, moving back in the list.
:Fetch the next command from the history list, moving forward in the list.
      next-history (C-n)
;beginning-of-history <nowiki>(M-<)</nowiki>
              Fetch the next command from the history list, moving forward in the list.
:Move to the first line in the history.
      beginning-of-history (M-<)
;end-of-history <nowiki>(M->)</nowiki>
              Move to the first line in the history.
:Move to the end of the input history, i.e., the line currently being entered.
      end-of-history (M->)
;reverse-search-history (C-r)
              Move to the end of the input history, i.e., the line currently being entered.
:Search backward starting at the current line and moving `up' through the history as necessary.  This is an incremental search.
      reverse-search-history (C-r)
;forward-search-history (C-s)
              Search backward starting at the current line and moving `up' through the history as neces‐
:Search forward starting at the current line and moving `down' through the history as  necessary.  This is an incremental search.
              sary.  This is an incremental search.
;non-incremental-reverse-search-history (M-p)
      forward-search-history (C-s)
:Search  backward  through the history starting at the current line using a non-incremental search for a string supplied by the user.
              Search forward starting at the current line and moving `down' through the history as  nec‐
;non-incremental-forward-search-history (M-n)
              essary.  This is an incremental search.
:Search forward through the history using a non-incremental search for a string supplied by the user.
      non-incremental-reverse-search-history (M-p)
;history-search-forward
              Search  backward  through the history starting at the current line using a non-incremental
:Search  forward  through the history for the string of characters between the start of the current line and the point.  This is a non-incremental search.
              search for a string supplied by the user.
;history-search-backward
      non-incremental-forward-search-history (M-n)
:Search backward through the history for the string of characters between the start of  the current line and the point.  This is a non-incremental search.
              Search forward through the history using a non-incremental search for a string supplied by
;history-substring-search-backward
              the user.
:Search  backward through the history for the string of characters between the start of the current line and the current cursor position (the point).  The  search  string  may  match anywhere in a history line.  This is a non-incremental search.
      history-search-forward
;history-substring-search-forward
              Search  forward  through the history for the string of characters between the start of the
:Search  forward  through the history for the string of characters between the start of the current line and the point.  The search string may match anywhere in a history line.  This is a non-incremental search.
              current line and the point.  This is a non-incremental search.
;yank-nth-arg (M-C-y)
      history-search-backward
:Insert the first argument to the previous command (usually the second word on the previous line) at point.  With an argument n, insert the nth word from the  previous  command  (the words  in  the  previous  command begin with word 0).  A negative argument inserts the nth word from the end of the previous command.  Once the argument n is computed, the  argument is extracted as if the "!n" history expansion had been specified.
              Search backward through the history for the string of characters between the start of  the
;yank-last-arg (M-., M-_)
              current line and the point.  This is a non-incremental search.
:Insert  the  last  argument to the previous command (the last word of the previous history entry).  With a numeric argument, behave exactly like yank-nth-arg.  Successive  calls  to yank-last-arg  move  back  through  the history list, inserting the last word (or the word specified by the argument to the first call) of each line in turn.  Any  numeric  argument supplied  to  these successive calls determines the direction to move through the history. A negative argument switches the direction through the history  (back  or  forward).  The history expansion facilities are used to extract the last word, as if the "!$" history expansion had been specified.
      history-substring-search-backward
;shell-expand-line (M-C-e)
              Search  backward through the history for the string of characters between the start of the
:Expand the line as the shell does.  This performs alias and history expansion as  well  as all  of  the shell word expansions.  See HISTORY EXPANSION below for a description of history expansion.
              current line and the current cursor position (the point).  The  search  string  may  match
;history-expand-line (M-^)
              anywhere in a history line.  This is a non-incremental search.
:Perform history expansion on the current line.  See HISTORY EXPANSION below for a description of history expansion.
      history-substring-search-forward
;magic-space
              Search  forward  through the history for the string of characters between the start of the
:Perform  history  expansion on the current line and insert a space.  See HISTORY EXPANSION below for a description of history expansion.
              current line and the point.  The search string may match anywhere in a history line.  This
;alias-expand-line
              is a non-incremental search.
:Perform alias expansion on the current line.  See ALIASES above for a description of alias expansion.
      yank-nth-arg (M-C-y)
;history-and-alias-expand-line
              Insert the first argument to the previous command (usually the second word on the previous
:Perform history and alias expansion on the current line.
              line) at point.  With an argument n, insert the nth word from the  previous  command  (the
;insert-last-argument (M-., M-_)
              words  in  the  previous  command begin with word 0).  A negative argument inserts the nth
:A synonym for yank-last-arg.
              word from the end of the previous command.  Once the argument n is computed, the  argument
;operate-and-get-next (C-o)
              is extracted as if the "!n" history expansion had been specified.
:Accept the current line for execution and fetch the next line relative to the current line from the history for editing.  A numeric argument, if supplied, specifies the history  entry to use instead of the current line.
      yank-last-arg (M-., M-_)
;edit-and-execute-command (C-x C-e)
              Insert  the  last  argument to the previous command (the last word of the previous history
:Invoke  an  editor  on the current command line, and execute the result as shell commands.
              entry).  With a numeric argument, behave exactly like yank-nth-arg.  Successive  calls  to
;Bash attempts to invoke $VISUAL, $EDITOR, and emacs as the editor, in that order.
              yank-last-arg  move  back  through  the history list, inserting the last word (or the word
              specified by the argument to the first call) of each line in turn.  Any  numeric  argument
              supplied  to  these successive calls determines the direction to move through the history.
              A negative argument switches the direction through the history  (back  or  forward).  The
              history expansion facilities are used to extract the last word, as if the "!$" history ex‐
              pansion had been specified.
      shell-expand-line (M-C-e)
              Expand the line as the shell does.  This performs alias and history expansion as  well  as
              all  of  the shell word expansions.  See HISTORY EXPANSION below for a description of his‐
              tory expansion.
      history-expand-line (M-^)
              Perform history expansion on the current line.  See HISTORY EXPANSION below for a descrip‐
              tion of history expansion.
      magic-space
              Perform  history  expansion on the current line and insert a space.  See HISTORY EXPANSION
              below for a description of history expansion.
      alias-expand-line
              Perform alias expansion on the current line.  See ALIASES above for a description of alias
              expansion.
      history-and-alias-expand-line
              Perform history and alias expansion on the current line.
      insert-last-argument (M-., M-_)
              A synonym for yank-last-arg.
      operate-and-get-next (C-o)
              Accept the current line for execution and fetch the next line relative to the current line
              from the history for editing.  A numeric argument, if supplied, specifies the history  en‐
              try to use instead of the current line.
      edit-and-execute-command (C-x C-e)
              Invoke  an  editor  on the current command line, and execute the result as shell commands.
              Bash attempts to invoke $VISUAL, $EDITOR, and emacs as the editor, in that order.


=== Commands for Changing Text ===
=== Commands for Changing Text ===