2

With the bash shell, you can install a trap on the synthetic DEBUG signal. This is useful and will execute your function or bit of code on every shell command, not so in ash, however. E.g.

$ trap 'echo hi' DEBUG -ash: trap: DEBUG: invalid signal specification

How do you trap the DEBUG signal in ash?

Ilias Karim
  • 4,798
  • 3
  • 38
  • 60
  • 1
    I don't think you can. I think DEBUG is a ksh extension that bash adopted. I think ash is intended to be as [pure-POSIX](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html) as possible – glenn jackman Jul 20 '22 at 00:51

0 Answers0