bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Aborting prompt with Ctrl-c sets exit status variable ($?) to 130


From: Eric Blake
Subject: Re: Aborting prompt with Ctrl-c sets exit status variable ($?) to 130
Date: Wed, 04 Jun 2014 13:34:22 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 06/04/2014 01:28 PM, Dennis Williamson wrote:
> On Jun 4, 2014 2:23 PM, "Jens Stimpfle" <address@hidden> wrote:
>>
>> Hi, please Cc: me as I'm not subscribed.

That's the general policy of any list which allows posts from
non-subscribers.

>>
>> When I abort a bash prompt using Ctrl-c, the $? variable is set to 130
>> just as if a job had been aborted. To illustrate, some terminal
>> contents:
>>

>> My feeling is that aborting a prompt should not change the $? variable.

I agree that it is annoying behavior that Ctrl-C changes $?, but at
least we're in good company, since ksh has the same behavior (well,
there $? is set to 258, since ksh takes advantage of the POSIX rule that
it can represent exit due to signal in $? by using values that are
unambiguous with regular exit).  zsh almost has the same behavior,
except it sets $? to 1 instead of any indication that a signal occurred.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]