-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preexec $1 is missing some commands #147
Comments
I guess that it is caused by your But this problem should also happen with your previous approach using You can also refer to #6 (comment) for the settings that can affect the behavior of
This is already reported in #6. This is a limitation of the current way of implementing
If you can assume Bash >= 4.4, you may use |
I'm recording command history in certain format into daily log files. I was using PROMPT_COMMAND to save the last command to a file. I was using
echo "$(history -p \!-1)"
to save the last item from history to a file. But that is causing some problems: 1) the command is recorded in log file when next command is run. 2) due to ignored commands (ls, cd, ll, clear, etc.) "last command" approach becomes out of sync.I discovered bash-preexec and it is exactly what I want "record the command as soon as I hit Enter with
preexec()
function"I updated by .bashrc accordingly, the concept is working but somehow preexec is missing some commands and do not record them and instead prints the previous command to log file. The ones that I noticed are;
hello-world () { echo "hello world!"; }
)Here's my old PROMPT_COMMAND:
Here's my new PROMPT_COMMAND:
And here's my
preexec()
function:What should I do so that whatever I write in prompt is saved to log file as soon as I hit Enter
The text was updated successfully, but these errors were encountered: