1

I'm running Korn 93u+ and I want to echo the current time each time I enter a command. I currently just put the time in my PS1, but that's obviously flawed because if I leave the command line for some period of time I end up with a stale timestamp. I'd rather have an operation that executes after I hit enter, e.g.

$ ls -a1
Running at 2025-01-08 14:25:30.

.
..
dummy_dir_1
dummy_dir_2
$

Is there a way to do that config-wise?

1 Answer 1

1

A very simply way is to trap ... DEBUG

e.g.

$ trap 'echo Running at $(date)' DEBUG
$ ls /var/tmp
Running at Wed Jan 8 19:07:05 EST 2025
systemd-private-f7c619ae552e4d6b96bd3089d35d77b8-cups.service-DX0Iti/
systemd-private-f7c619ae552e4d6b96bd3089d35d77b8-dovecot.service-IGzccG/
systemd-private-f7c619ae552e4d6b96bd3089d35d77b8-httpd.service-5CaI8v/
systemd-private-f7c619ae552e4d6b96bd3089d35d77b8-ntpd.service-F8tpA0/
$ echo hello
Running at Wed Jan 8 19:07:11 EST 2025
hello
$ pwd
Running at Wed Jan 8 19:07:12 EST 2025
/home/sweh

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.