bug-bash
[Top][All Lists]
Advanced

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

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


From: Jens Stimpfle
Subject: Aborting prompt with Ctrl-c sets exit status variable ($?) to 130
Date: Wed, 4 Jun 2014 21:23:02 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi, please Cc: me as I'm not subscribed.

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:

address@hidden:~$ echo Hello
Hello
address@hidden:~$ echo $?
0
address@hidden:~$ echo H^C
address@hidden:~$ echo $?
130
address@hidden:~$

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

 ?      Expands to the exit status of the most recently executed
        foreground pipeline.

I don't think the prompt counts as a pipeline (it can't be job
controlled).

This behaviour is particularly annoying when I log out from an SSH
session using Ctrl-c Ctrl-d:

address@hidden:~$ ssh riese
[...]
address@hidden:~$ foo^C
address@hidden:~$ logout
Connection to riese closed.
address@hidden:~$ echo $?
130
address@hidden:~$ 

What are your thoughts?



reply via email to

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