[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:
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?
- Aborting prompt with Ctrl-c sets exit status variable ($?) to 130,
Jens Stimpfle <=