Sample Header Ad - 728x90

PROMPT_COMMAND usage in Bash on macOS

1 vote
0 answers
37 views
I'm trying to use Linux bash config on a mac. I don't use zsh only bash on my mac. I have problem with this variable:
# After each command, append to the history file and reread it
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$'\n'}history -a; history -c; history -r"
I'm not sure what is the source of this code, but i use it on Linux to keep all history from different terminal tabs in sync. But on mac I got empty history. I'm not sure if this something that was from the start after I added this to my .bashrc or something that appeared just now. I didn't notice any problems before, but I use mac only for few weeks, and I may not use history at all. I have fzf setup, but I may not use CTRL+R at all. And I'm not sure if I used up arrow. This is something that I don't pay much attention to, I do this automatically.
Asked by jcubic (10310 rep)
Jul 28, 2025, 11:13 AM
Last activity: Jul 28, 2025, 11:55 AM