Score:0

PROMPT_COMMAND duplicating commands on new sessions

cn flag

Im playing around with PROMPT_COMMAND variable Was testing out some ways to save all commands into a log file and got some ways using PROMPT_COMMAND + logger + rsyslog

Example export im using

export PROMPT_COMMAND='logger -p local6.debug "$(whoami): $(history 1 | sed "s/^[ ][0-9]+[ ]//" ) "'

Its working fine, but I notice that everytime I login in a new session, ssh / sudo / etc... it will log the last entrance on history (from old sessions) again on the logs

After checking some doc I get that PROMPT_COMMAND will execute always before bash show prompt, and it means even on your first session prompt when you logging into your system

Wonder if someone already notice it, and if there are some way to avoid it from logging on when login new session on bash

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.