<a href="http:&#x2F;&#x2F;pastebin.com&#x2F;zJkPW79C" rel="nofollow">http:&#x2F;&#x2F;pastebin.com&#x2F;zJkPW79C</a><p>I use bash-preexec [1] to hook on the even just before executing a command. I&#x27;m kind of nervous if my string quoting is safe though.<p>[1] <a href="https:&#x2F;&#x2F;github.com&#x2F;rcaloras&#x2F;bash-preexec" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rcaloras&#x2F;bash-preexec</a>