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:

jfs@knirps:~$ echo Hello
Hello
jfs@knirps:~$ echo $?
0
jfs@knirps:~$ echo H^C
jfs@knirps:~$ echo $?
130
jfs@knirps:~$

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:

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

What are your thoughts?

Reply via email to