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:
bash$ history 1 mount /mnt/cdrom 2 cd /mnt/cdrom 3 ls ...
Internal variables associated with Bash history commands:
Unfortunately, the Bash history tools find no use in scripting.
1 #!/bin/bash 2 # history.sh 3 # Attempt to use 'history' command in a script. 4 5 history 6 7 # Script produces no output. 8 # History commands do not work within a script.
bash$ ./history.sh (no output)