Comments (9)
Yes, you are right. That is the behavior of Bash. Or do you see any difference in the behavior with and without ble.sh?
In the first place, the in-memory command history and the history file is not synchronized for every command. It is only synchronized when the Bash session ends or you run history -w
or history -a
(depending on your preference). The command history -c
only clears the in-memory command history. If you would like the in-memory history to be reflected in the history file, you need to run history -w
in a row.
If you expect the in-memory history to be reflected in the history file on the session end (including the removal of entries), please make sure the shell option histappend
is turned off (i.e., `shopt -u histappend).
from ble.sh.
But after running shopt -u histappend
, history -c
still doesn't clean ~/.bash_history
.
from ble.sh.
shopt -u histappend
is just a setting to control the behavior on the session end. Changing the setting doesn't immediately clean ~/.bash_history
. You need to exit the session for shopt -u histappend
to take an effect.
If you would like to reflect the content of the in-memory command history into the history file immediately, you need to run history -w
.
from ble.sh.
P.S. "the session end" means that you exit the current Bash session by running exit
, by pressing C-d on an empty command line, or by closing the terminal window.
from ble.sh.
In fact I ran history -c
, exited the session and ~/.bash_history
still wasn't cleaned up.
from ble.sh.
The behavior you reported does not reproduce in my environment. I tried bash-5.1 and 5.2. I also tried it with and without oh-my-bash and bash-completion. Always, the consequence of history -c
is reflected to ~/.bash_history
when the Bash session ends in my environment.
- Q1: Does the reported behavior reproduce with a plain Bash plus ble.sh (without any other configurations)?
from ble.sh.
- Q2: Could you give me the result of the following command?
$ ble/widget/display-shell-version
from ble.sh.
After I manually deleted ~/.bash_history
, it strangely became clearable with history -c
.
I don't know why but it works fine now.
from ble.sh.
Thanks for the information. Hmm, one possibility is that it was caused by the permission of the file. When I change the permission of the history file as chmod 400 ~/.bash_history
, I can reproduce the behavior of not clearing the file content, though it doesn't allow appending new entries in ~/.bash_history
either.
from ble.sh.
Related Issues (20)
- Unable to set ble-face `syntax_function_name` HOT 7
- Source ble.sh each time when restart a console will increase the time cost. HOT 15
- expanding abbreviations that are the results of completions HOT 1
- [SUSE /etc/inputrc] issues sourcing ble.sh HOT 16
- [WSL] ble.sh breaks on start and does not let me type in the console HOT 40
- Several questions about ble.sh usage HOT 8
- Exit status 1 when using pipe and grep HOT 6
- [Alacritty v0.7.0-0.13.1] Newlines inserted when scrolling up HOT 16
- Sabbrev expansions not working HOT 8
- Disable option completion HOT 4
- [WINCH in ble/prompt/update] Cyclic dependency error HOT 13
- Moving down through history gets stuck in multiline HOT 2
- Cannot bind RET in nsearch mode HOT 3
- Kitty's terminal protocol & complete_menu_complete_opts HOT 7
- Incorrect behaviour with C-w HOT 4
- Always one frame (16.7ms) delay between pressing enter and running command HOT 9
- C-RET never works HOT 6
- ln=target in LS_COLORS breaks ble.sh autocomplete highlight HOT 3
- [zellij 0.40.1] Zellij HOT 2
- [tealdeer 1.61] the tldr completion produces errors and a few questions HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ble.sh.