News for hackers. Stuff that matters.
Re:Ask HN: How to Extract Shell Commands from Raw PTY Sessio... by ksherlock on Monday August 04, 2025 @04:20PM (#44790917)
For bash, you can use `trap [code] DEBUG` to run your code before the command executes. $BASH_COMMAND should be the set to the command that's going to run.

Alternatively, look at the $PROMPT_COMMAND which runs before printing the $PS1 prompt (so maybe you could check `history 1` to get the command afterwards)

Re:Ask HN: How to Extract Shell Commands from Raw PTY Sessio... by debba on Tuesday August 05, 2025 @05:29PM (#44804593)
I will check thanks, need to find a solution common for every shell.