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


Groups > gnu.bash.bug > #16151

looking for consistent C-c trap behavior

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 <mailman.535.1587153583.3066.bug-bash@gnu.org> (permalink)
References <M58iOBd--3-2@tutanota.com>
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 <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <M58iOBd--3-2@tutanota.com>
Xref csiph.com gnu.bash.bug:16151

Show key headers only | 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