/usr/bin/bash: Difference between revisions

Line 2,239: Line 2,239:
;<nowiki>history -s arg [arg ...]</nowiki>
;<nowiki>history -s arg [arg ...]</nowiki>
:With  no options, display the command history list with line numbers.  Lines listed with a * have been modified.  An argument of n lists only the last n lines.  If the  shell  variable  HISTTIMEFORMAT is set and not null, it is used as a format string for strftime(3) to display the time stamp associated with each displayed history entry.  No intervening blank is  printed  between  the  formatted time stamp and the history line.  If filename is supplied, it is used as the name of the history file; if not, the value of HISTFILE is  used. Options, if supplied, have the following meanings:
:With  no options, display the command history list with line numbers.  Lines listed with a * have been modified.  An argument of n lists only the last n lines.  If the  shell  variable  HISTTIMEFORMAT is set and not null, it is used as a format string for strftime(3) to display the time stamp associated with each displayed history entry.  No intervening blank is  printed  between  the  formatted time stamp and the history line.  If filename is supplied, it is used as the name of the history file; if not, the value of HISTFILE is  used. Options, if supplied, have the following meanings:
;;-c
:;-c
::Clear the history list by deleting all the entries.
::Clear the history list by deleting all the entries.
;;-d offset
:;-d offset
::Delete  the  history entry at position offset.  If offset is negative, it is interpreted as relative to one greater than the last history position, so  negative  indices count back from the end of the history, and an index of -1 refers to the current history -d command.
::Delete  the  history entry at position offset.  If offset is negative, it is interpreted as relative to one greater than the last history position, so  negative  indices count back from the end of the history, and an index of -1 refers to the current history -d command.
;;-d start-end
:;-d start-end
::Delete the history entries between positions start and  end,  inclusive.  Positive and negative values for start and end are interpreted as described above.
::Delete the history entries between positions start and  end,  inclusive.  Positive and negative values for start and end are interpreted as described above.
;;-a
:;-a
::Append  the ``new'' history lines to the history file.  These are history lines entered since the beginning of the current bash session, but not already appended  to the history file.
::Append  the ``new'' history lines to the history file.  These are history lines entered since the beginning of the current bash session, but not already appended  to the history file.
;;-n
:;-n
::Read the history lines not already read from the history file into the current history list.  These are lines appended to the history file since the beginning of the current bash session.
::Read the history lines not already read from the history file into the current history list.  These are lines appended to the history file since the beginning of the current bash session.
;;-r
:;-r
::Read the contents of the history file and append them to the current history list.
::Read the contents of the history file and append them to the current history list.
;;-w
:;-w
::Write  the current history list to the history file, overwriting the history file's contents.
::Write  the current history list to the history file, overwriting the history file's contents.
;;-p
:;-p
::Perform history substitution on the following args and display the  result  on  the standard output.  Does not store the results in the history list.  Each arg must be quoted to disable normal history expansion.
::Perform history substitution on the following args and display the  result  on  the standard output.  Does not store the results in the history list.  Each arg must be quoted to disable normal history expansion.
;;-s
:;-s
::Store the args in the history list as a single entry.  The last command in the history list is removed before the args are added.
::Store the args in the history list as a single entry.  The last command in the history list is removed before the args are added.