Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
read still active after Ctrl-C
- X-seq: zsh-users 21602
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: read still active after Ctrl-C
- Date: Thu, 2 Jun 2016 08:19:56 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=xGuy1bDCw9si9HnKeKMpiKdR4KLchbLnYRJiTW/1Ors=; b=lWiEm+jcAl3QI19mWQlWmaE3uD5LgbImAfe5jCapLIoALosumFJdksFnhGY4R2yG6h uVBQ07wvBU3oFdSc8bs5G7PI5xwIQoF+hBfTppIGHCf2YO3cBYMUdkaRegpXU31kuCde 5nauNL93RDzluUXdc/MFvT0ODFUUdF8CrBGjK00nM2RtWIbHt7uD71ChQBHpx3q7K5vs byIUBYT2l8E5g4D2VeVljEOhcqKWS8y84YBTl5l1mHJjng1ktD1v/LAprbmQq2d4QkBf eTVklhP1nJ/UuiZqoSxMagON++likbEGWBbFpY5oz32YBaMRjgncfxKGFOQm196DZSwA mXtQ==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
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