Skip to content

Instantly share code, notes, and snippets.

@0x3333
Created October 25, 2018 19:43
Show Gist options
  • Save 0x3333/2c63b668295cb49579148c1a4065b4e8 to your computer and use it in GitHub Desktop.
Save 0x3333/2c63b668295cb49579148c1a4065b4e8 to your computer and use it in GitHub Desktop.
Debug a ZSH Script - Ask for a confirmation before every command is issued
#!/usr/bin/zsh
TRAPDEBUG() {
read -q "?run \"$ZSH_DEBUG_CMD\"? " || setopt errexit
echo > /dev/tty
}
echo "First command"
echo "Second command"
echo "Last command"
$ zsh debug.sh
run "echo "1""? y
First command
run "echo "2""? y
Second command
run "echo "3""? y
Last command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment