Timeline for Can I configure bash to execute "clear" before every command typed in the console?
Current License: CC BY-SA 4.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 8, 2022 at 21:11 | comment | added | jasonleonhard | You are welcome. I am glad to be of service. | |
| Nov 8, 2022 at 8:28 | comment | added | David Wolf | Wonderful. By calling the function the hook is registered, now I understand – thanks a lot @jasonleonhard | |
| Nov 8, 2022 at 4:16 | comment | added | jasonleonhard | As an alternative to the currently accepted answer which if you had in your .zshrc or similar would run all the time which you might not actually want. | |
| Nov 8, 2022 at 4:15 | comment | added | jasonleonhard | @DavidWolf The hook is called preexec, I called my function cb4, call it whatever you want. You are calling a method that calls the hook which runs clear after every command you run (making your command at the top of your terminal window which I wanted at the time for something specific, your usage may vary). But if you open a new terminal then that will not clear automatically, that would require running the command cb4 again. That is intentional, so you only call cb4 once when you know after every command following it you want that behavior. | |
| Nov 2, 2022 at 14:27 | comment | added | David Wolf | Can you please explain what the role of cb4 is? Is it a built-in name or something you came up with, what does it do, is it something like a “scoped” configuration/named session? Thanks | |
| Dec 12, 2019 at 17:58 | history | answered | jasonleonhard | CC BY-SA 4.0 |