Is there a way to run one command before any terminal command gets executed? For example: > ls -ltr> Hello you ran ls -ltr //this is what I would like to achieve> ..output of ls -ltr will be hereIs it possible to run make sure an echo runs before any command is executed?Thanks
Run a command before any terminal command
bash
You might want to look into setting a DEBUG trap, which allows you to set up what is effectively a pre-exec hook in a manner similar to zsh.  See https://superuser.com/questions/175799/does-bash-have-a-hook-that-is-run-before-executing-a-command.