Appendix F. History Commands

The Bash shell provides command-line tools for editing and manipulating a user's command history. This is primarily a convenience, a means of saving keystrokes.

Bash history commands:

  1. history

  2. fc




                  bash$ 
                    history
                  
  1  mount /mnt/cdrom
    2  cd /mnt/cdrom
    3  ls
     ...

          


Internal variables associated with Bash history commands:

  1. $HISTCMD

  2. $HISTCONTROL

  3. $HISTIGNORE

  4. $HISTFILE

  5. $HISTFILESIZE

  6. $HISTSIZE

  7. !!

  8. !$

  9. !#

  10. !N

  11. !-N

  12. !STRING

  13. !?STRING?

  14. ^STRING^string^



Unfortunately, the Bash history tools find no use in scripting.

#!/bin/bash
# history.sh
# Attempt to use 'history' command in a script.

history

# Script produces no output.
# History commands do not work within a script.
          



                  bash$ 
                    ./history.sh
                  
(no output)       

          

Retour en haut de la page
Mandragor.org - Version 8.3