Execute a script, printing each command before executing it

zsh

  • Z SHell, a Bash-compatible command-line interpreter.
    See also `histexpand` for history expansion.
    More information: <https://www.zsh.org>.
  • Trick copyright: tl;dr; <https://github.com/tldr-pages/tldr>

zsh --xtrace {{path/to/script.zsh}}

click the source code to copy install zsh on any operating system with command-not-found.com