To execute a cmd before every command entered, set a trap on DEBUG. Eg.
trap date DEBUG
To execute that command before emitting a prompt, set PROMPT_COMMAND:
PROMPT_COMMAND=date
More Related Contents:
- What’s the magic of “-” (a dash) in command-line parameters?
- How to check if sed has changed a file
- How do you filter out all unique lines in a file?
- Iterate over a list of files with spaces
- ./configure : /bin/sh^M : bad interpreter [duplicate]
- Defining a variable with or without export
- The ‘eval’ command in Bash and its typical uses
- Better way to rename files based on multiple patterns
- How to join multiple lines of file names into one with custom delimiter?
- Syntax error in shell script with process substitution
- Linux: copy and create destination dir if it does not exist
- What is the difference between “#!/usr/bin/env bash” and “#!/usr/bin/bash”?
- How to handle more than 10 parameters in shell
- How to count lines in a document? [closed]
- How to preserve line breaks when storing command output to a variable?
- Perl command line multi-line replace
- Changing default shell in Linux [closed]
- How to use sed to remove the last n lines of a file
- Example of using named pipes in Linux shell (Bash)
- Passing variables in remote ssh command
- Syntax error: “(” unexpected — with !(*.sh) in bash script
- How do I run multiple background commands in bash in a single line?
- How do I change bash history completion to complete what’s already on the line?
- How to join multiple lines of filenames into one with custom delimiter
- How can I run a Windows executable from WSL (Ubuntu) Bash
- Running shell script in parallel
- What’s the point of eval/bash -c as opposed to just evaluating a variable?
- How to pass parameters to a Bash script?
- Run script with rc.local: script works, but not at boot
- Write a bash shell script that consumes a constant amount of RAM for a user defined time [closed]