Prevent that Dolphin's Terminal Panel adds "cd" and "clear" commands to the shell history?

Frank Reininghaus frank78ac at googlemail.com
Thu May 31 08:28:43 BST 2012


Hi,

there is a rather old bug report [1] and a rather new forum topic [2]
about the Terminal Panel sending "clear" and "cd" commands to the
Konsole Part, which are then added to the shell history. It seems that
this pollution of the history with commands that were not actually
entered by the user is unwanted by some (maybe even most/all) users.
Actually, I am one of them. It really is inconvenient to press "Up"
multiple times after changing the directory to interesting parts of
the history.

Some shells offer an easy way to prevent that commands are added to
the history: just prepend the command with a space. This works in:

a) bash, if HISTCONTROL includes ignorespace or ignoreboth (which
seems to be the default here on OpenSuse)
b) zsh, if some settings are used (seems not to be the default here).

So I'm wondering if we should do something about this issue. I see the
following options:

1. Prepend the "cd" and "clear" commands in
TerminalPanel::sendCdToTerminal() with a space. This would fix the
issue for all users who use bash with ignorespace/ignoreboth (which
might be the majority of users).

2. Add some additional magic to use the right settings for the shell
used by the user, if it is not bash. This would require quite complex
and bug-prone code, I'm afraid.

3. Leave it as it is and put up with the "clear" and "cd" commands in
the history.

I quite like option 1 because of its simplicity, however, a hardcoded
space that has an effect for some users, but not for others is
certainly not a perfect solution.

In the forum, it was suggested to add a config option for this, but I
believe that this would not be justified - there are probably not many
users who want commands in their history that have not been entered
manually.

Any opinions on this?

Best regards,
Frank

[1] https://bugs.kde.org/show_bug.cgi?id=204039
[2] http://forum.kde.org/viewtopic.php?f=224&t=102343




More information about the kfm-devel mailing list