[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bash' command history

From: Sven-Erik Petermann
Subject: bash' command history
Date: Wed, 18 Jun 2003 10:35:17 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2.1) Gecko/20021130


Why isn't there a method in command history management that prevents adding the current command line to the history, if it's already there? Say, I run a program ./a 20 times in a row, this causes the history to be filled with 20 lines of the string "./a". For me, it's pointless and very annoying. So, I altered the add_history function in lib/readline/history.c and the result was: add_history first checks if the string to be added is already in history, if it's not, it proceeds and adds the line to history. But, if the line is already in history then entries after the line found (that contains the command currently being added to the history) are moved down one slot and the current command line is moved to the top of the history. So, is this kind of feature somehow insecure or unwanted, or are you interested in the lines of code I added?

Sven-Erik Petermann
University of Tartu

reply via email to

[Prev in Thread] Current Thread [Next in Thread]