28 строки
597 B
Bash
Executable File
28 строки
597 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Add the following 2 lines to your ~/.bashrc file to tell bash to save your history
|
|
# to the history file after each command rather than after shell exit
|
|
#
|
|
# shopt -s histappend
|
|
# PROMPT_COMMAND="history -a;$PROMPT_COMMAND"
|
|
#
|
|
|
|
#Ensure we have the quantity specified on the CLI
|
|
if [ -z "$2" ]; then ARG_ERR=ERR; fi
|
|
if [ -z "$1" ]; then ARG_ERR=ERR; fi
|
|
if [ -n "$ARG_ERR" ];
|
|
then
|
|
echo "Usage: <sleeptimesecs> <numberoflines>"
|
|
exit
|
|
fi
|
|
|
|
sleeptimesecs=$1
|
|
numberoflines=$2
|
|
|
|
# Tail history
|
|
while [ 1 ]; do
|
|
clear
|
|
tail -$numberoflines ~/.bash_history
|
|
sleep $sleeptimesecs
|
|
done
|