Path: csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: gentoo_eshoes@tutanota.com Newsgroups: gnu.bash.bug Subject: looking for consistent C-c trap behavior Date: Fri, 17 Apr 2020 21:59:32 +0200 (CEST) Lines: 10 Approved: bug-bash@gnu.org Message-ID: References: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1587153584 14961 209.51.188.17 (17 Apr 2020 19:59:44 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash@gnu.org Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1587153572; s=s1; d=tutanota.com; h=From:From:To:To:Subject:Subject:Content-Description:Content-ID:Content-Type:Content-Type:Content-Transfer-Encoding:Content-Transfer-Encoding:Cc:Date:Date:In-Reply-To:MIME-Version:MIME-Version:Message-ID:Message-ID:Reply-To:References:Sender; bh=Uvn9VmxR+lLd+fNgSSqdZp5OLMcxQF9ja0aErpT+VJQ=; b=S3iOdS9oopQmbYHg8o4Wba5Qc0GFSEH58CJ30FxH8p+WAJdxgekHxOpjzWzjONS4 vjKTrBiwJsD2+NUKhQzDD6cnXfsJ34QJZ6jyWdYPmXm490K7WMrG7WQBQC3MMjDP+Db Bt/mlsAesQ5qUb015NR2HArEHSRFKn0zpjdAXlXHEbKgoVTJwCJPq/i3drncPUfAm76 yXGYSJTnasNbG9kbfXs0HzWvrT5k+nxKieke+cuU5fTCB1iyAIWS7RavXefNWukxfGv Dg8/29+07y+lAifLQgmAZDopYtHMYGE40G8+A48auuIHk9gNv7M06zSxzJJMbISUGNI S+y6CDpqEA== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 81.3.6.162 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: Xref: csiph.com gnu.bash.bug:16151 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.