Registered Member
|
I regularly make use of the HISTCONTROL="ignorespace" to omit entires on my bash history. When I open up a terminal in dolphin the "cd /directory" appears in ~/bash_history. My history is cluttered wit these entries and I'd like to completely omit any entry beginning with "cd" from writing to bash_history. How can I go about doing this?
Edit: FIXED in KDE 4.9 by Frank Reininghaus
Last edited by oracle2b on Thu Sep 06, 2012 9:15 pm, edited 1 time in total.
All answers are all replies, but not all replies are answers.
|
Manager
|
from http://www.thegeekstuff.com/2008/08/15- ... /#more-130
|
Registered Member
|
I tried using
# export HISTIGNORE="cd *" and # export HISTIGNORE="cd /*" but that didn't work.
All answers are all replies, but not all replies are answers.
|
Manager
|
either HISTIGNORE does not allow wild cards, uses a different syntax or there is another option needed to enable them - no idea
2 thoughts: 1) if the number of folders cd'ed to is limited list them explicitly in HISTIGNORE 2) alias history to alias history='history|grep -v cd', of course you'd want to do something a bit more complex using regexp and checking that the first 3 non-blank chars are = 'cd ' |
Moderator
|
AFAIK, commands are not added to the history if they are prepended with one or more spaces. Maybe we should just send the "cd" command with a space prepended in TerminalPanel::sendCdToTerminal(const QString&). That would resolve this issue without any action required on the user side.
|
Moderator
|
Hm, it seems that this is only true for bash. I've tried zsh and sh, and these also commands with a prepended space to the history. But they execute the command correctly, so it seems that adding the space would at least not cause any trouble for non-bash users. |
Manager
|
freininghaus - in zsh you'd need to enable the option and for bash you'll need to ensure that the option is enabled (for me it was)
for zsh http://zsh.sourceforge.net/Doc/Release/Options.html
also there is the case that the user wishes cd to be included in history so a config option should be available |
Moderator
|
google01103: Thanks for the info!
Unfortunately, enabling options based on which shell the user uses seems to be pretty difficult to me. At the moment, we just create the terminal using the KonsolePart factory. Konsole does all the work for us. I'm not sure if the config option is a good idea. I think that one should try to keep the number of options low and only add an option if there really is a large group of users who are not happy with the default. So I would say that we should either leave it as it is or add a hardcoded space, but I'l discuss this with Peter. |
Manager
|
this appears to be the most accurate as the shell being run is not necessarily your default shell
|
Moderator
|
We could send that command to the shell inside the Terminal Panel, but AFAIK there's no way to read out the result from Dolphin. Even if we could find out the shell being run using your suggestion, it's still far from trivial to adjust the shell's settings appropriately. We would need a lot of complex and bug-prone code for that. I've started a discussion on the mailing list about this isse: http://lists.kde.org/?t=133844952400003&r=1&w=2. It looks like we'll add a hardcoded space to the commands sent to the terminal. |
Registered Member
|
I'd just like to thank everyone in this thread for helping to solve this issue and making my request a staple in future KDE releases.
All answers are all replies, but not all replies are answers.
|
Registered Member
|
I think this problem is back. I am on KDE 22.04.3 and Dolphin, Kate spam the terminal with cd commands which I don't know how to ignore.
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]