Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

read still active after Ctrl-C



Hello,
how to leave whole script on Ctrl-C? Below is a simple example where
read is still active and waits for a key after Ctrl-C is pressed

#!/usr/bin/env zsh

trap "endprog; exit" TERM INT QUIT
trap "endprog" EXIT

endprog() {
    echo "Am called"
}

wait_for_any_key() {
    read -rs -k 1 -t "$1"
}

wait_for_any_key 60 && exit



Messages sorted by: Reverse Date, Date, Thread, Author