HISTORY(3) Library Functions Manual HISTORY(3) (NAME) history - (GNU History Library) (COPYRIGHT) The GNU History Library is Copyright (C) 1989-2020 by the Free Software Foundation, Inc. (DESCRIPTION) . GNU History . (HISTORY EXPANSION) bash . . . . . . . <<>> (event) <<>> (words) . <<>> (modifiers) . bash ( history_tokenize() ). ! . (\) (quote) . (Event Designators) . . ! blank = ( . !n n. !-n n. !! . `!-1' . !string string . !?string[?] string . ? string . string . ^string1^string2^ . string1 string2. ``!!:s^string1^string2^'' ( ). !# . (Word Designators) . : . ^ $ * - % . 0 () . . 0 (zero) . . n n-. ^ 1. $ . . % `?string?' . x-y `-y' `0-y' . * . `1-$' . * . x* x-$ . x- x* x-$ . x 0 . . (Modifiers) `:` . . h (head). t (tail). r .xxx (basename). e . p . q . x q (blanks) . q x . s/old/new/ new old . / . . old new . & new old . & . old old string !?string[?] . new old . & . g . `:s' ( `:gs/old/new/') `:&' . `:s' / . a g . G `s' `&' . (PROGRAMMING WITH HISTORY FUNCTIONS) History . (Introduction to History) History . (expansion) . History . bash . readline . History History . extern . (History Storage) . : typedef void * histdata_t; typedef struct _hist_entry { char *line; char *timestamp; histdata_t data; } HIST_ENTRY; : HIST_ENTRY ** the_history_list; History : /* * . */ typedef struct _hist_state { HIST_ENTRY **entries; /* . */ int offset; /* . */ int length; /* . */ int size; /* . */ int flags; } HISTORY_STATE; flags HS_STIFLED (stifled) . (History Functions) GNU History . (Initializing History and State Management) History . void using_history (void) . . HISTORY_STATE * history_get_history_state (void) . void history_set_history_state (HISTORY_STATE *state) state. (History List Management) . void add_history (const char *string) string . ( ) NULL . stifle_history() . void add_history_time (const char *string) string. HIST_ENTRY * remove_history (int which) which . . histdata_t free_history_entry (HIST_ENTRY *histent) histent . . HIST_ENTRY * replace_history_entry (int which, const char *line, histdata_t data) line data which. . which NULL . void clear_history (void) . void stifle_history (int max) max . max . int unstifle_history (void) . ( stifle_history() ). . int history_is_stifled (void) . (Information About the History List) . HIST_ENTRY ** history_list (void) NULL HIST_ENTRY * . 0 . NULL . int where_history (void) . HIST_ENTRY * current_history (void) where_history() . NULL . HIST_ENTRY * history_get (int offset) offset. offset history_base history_length - 1 . offset NULL . time_t history_get_time (HIST_ENTRY *) . int history_total_bytes (void) . . (Moving Around the History List) . int history_set_pos (int pos) pos . 1 pos 0 . HIST_ENTRY * previous_history (void) . NULL . HIST_ENTRY * next_history (void) . NULL . (Searching the History List) . . (anchored) . int history_search (const char *string, int direction) string . direction 0 . string string . -1 . int history_search_prefix (const char *string, int direction) string . : string . direction 0 . string 0 . -1 . int history_search_pos (const char *string, int direction, int pos) string pos . direction pos . string -1 . (Managing the History File) History . . int read_history (const char *filename) filename . filename NULL ~/.history . 0 errno . int read_history_range (const char *filename, int from, int to) filename . from to . from . to from . filename NULL ~/.history . 0 errno . int write_history (const char *filename) filename filename . filename NULL ~/.history . 0 errno . int append_history (int nelements, const char *filename) nelements filename. filename NULL ~/.history . 0 errno . int history_truncate_file (const char *filename, int nlines) filename nlines . filename NULL ~/.history . 0 errno . (History Expansion) . int history_expand (char *string, char **output) string output . : 0 ( ) 1 -1 2 :p. output . char * get_history_event (const char *string, int *cindex, int qchar) string + *cindex . *cindex . cindex string . qchar <<>> . char ** history_tokenize (const char *string) (tokens) string . history_word_delimiters . char * history_arg_extract (int first, int last, const char *string) first last string. history_tokenize() . (History Variables) GNU History . int history_base . int history_length . int history_max_entries . stifle_history() . int history_write_timestamps . 0 . history_comment_char . ( ) . char history_expansion_char . ! . 0 . char history_subst_char . ^ . char history_comment_char . . char * history_word_delimiters history_tokenize() . " \t\n()<>;&|" . char * history_no_expand_chars history_expansion_char . (space) (tab) (newline) \r = . char * history_search_delimiter_chars : ? . . int history_quotes_inhibit_expansion . 0 . rl_linebuf_func_t * history_inhibit_expansion_function : char * (string) int (i). string[i] 0 . bash . NULL . (FILES) ~/.history (SEE ALSO) The Gnu Readline Library, Brian Fox and Chet Ramey The Gnu History Library, Brian Fox and Chet Ramey bash(1) readline(3) (AUTHOR) Brian Fox, Free Software Foundation bfox@gnu.org Chet Ramey, Case Western Reserve University chet.ramey@case.edu (REPORTING BUGS) history . history . bug-readline@gnu.org . ! <<>> bug-readline@gnu.org gnu.bash.bug . chet.ramey@case.edu . GNU History 8.1 2020 July 17 HISTORY(3)