Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #16151

looking for consistent C-c trap behavior

From gentoo_eshoes@tutanota.com
Newsgroups gnu.bash.bug
Subject looking for consistent C-c trap behavior
Date 2020-04-17 21:59 +0200
Message-ID <mailman.535.1587153583.3066.bug-bash@gnu.org> (permalink)
References <M58iOBd--3-2@tutanota.com>

Show all headers | View raw


I've noticed that if I trap SIGINT in a bash script, the behavior when encountering C-c depends on whether an external command (eg. 'sleep 100') or a builtin command (like 'read -p') was encountered.

I attach an example script which requires me to press C-c twice to interrupt the builtin 'read -p' command, and it only works because I'm restoring the trap via 'trap - SIGINT' the first time.

My goal is to have C-c interrupt and use that exit code (130 most likely) to exit with from script, regardless or whether or not the interrupted command in the script was an internal or external one.

How to do?

Thanks.

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

looking for consistent C-c trap behavior gentoo_eshoes@tutanota.com - 2020-04-17 21:59 +0200

csiph-web