3 ms·
This is my least favourite thing about shell history as well. It fails at being shell history log, because it's dropping more than it retains.
by loa_in_ 3y ago
This is my least favourite thing about shell history as well. It fails at being shell history log, because it's dropping more than it retains.
- hnlmorg 3y agoI hate that too but it’s worth noting that this is a bashism. It’s not a problem with some other alternative shells.
- jraph 3y agoYep, zsh, and most likely fish and other shells manage to keep all your commands in the history, no matter how many sessions you open.
- calmoo 3y agoI find this can be a bit messy because VS code runs lots of commands in the background that pollute the history with extremely verbose commands.
- deleted 3y ago[deleted]
- wruza 3y agoWhy does it run them in interactive shells? Not surpising given it’s Microsoft, but still worth reporting an issue.
- hnlmorg 3y agoI can’t speak for VSC specifically (I don’t like their terminal emulator so don’t have enough experience using it) but I do know some other applications “paste” (for want a better word) commands into the script interactive shell because they purpose of the shell being open is to provide a REPL and the GUI application just provides a few useful graphical hooks to it. Regarding the history problem, there’s likely a flag VSC can pass to Zsh to disable writing to history for that session. Edit: looks like there are several ways: https://unix.stackexchange.com/questions/692913/temporarily-disable-history-in-zsh https://unix.stackexchange.com/questions/692913/temporarily-...
- gumby 3y agoBash was written when disks were a few megabytes. It’s trivial to tell it to keep an infinite log, as others have commented.
- hnlmorg 3y agoThe issue isn’t the length of the history. It’s that the history is written to at the end of the bash session. So if you have multiple sessions open then one session with overwrite another session log. Even if your point was right though, I’d argue that because Bash is still being maintained, any defaults originating from the 80s should be updated. Yes, I know there are low footprint environments out there that still have writable storage in the region of a few megabytes (or even less), but we have other shells for those use cases.
- gumby 3y agoChanging defaults can have unexpected consequences, especially ones that have storage implication and especially in programs that are so tied to scripting. I agree that the default is unfortunate but the points above seem more important.
- hnlmorg 3y agoChanging bash history retention wouldn’t affect scripts. Scripts don’t write to the history log. And bash has already changed numerous features over the years.