If I type a command, and halfway through I decide not to run that command, I do a Control-C to cancel it without having to backspace the whole thing, e.g. mv foo.txt bar.txt
. On Ubuntu it'll show up as mv foo.txt bar.txt^C
to remind me I cancelled it, but on Mac it shows up as just mv foo.txt bar.txt
. Any way to get that ^C
behaviour on Mac?
2 Answers
I'm not entirely sure of this, but for a different reason I upgrade the Bash on my machine (brew install bash
) and this behaviour started to show up. This post is what I followed to update Bash. It would be good practice not to overwrite your old Bash but instead just use the new one. Brew puts the new Bash at /local/usr/bin/bash
anyway.
On most Unix systems you can modify the shell to either show the output of the control character as the character or as a "^C". This can be done with the echoctl
or ctlecho
stty modes.
Use stty echoctl
to print the ^C characters
and stty -echoctl
to allow the shell to print the control character as the actual character, a SIGINT
in this case.
Doing this on a Linux machine seems to alter the behavior correctly, but on my MAC it will not show the character either way, on 10.11.something.
^C
for me in Terminal under OS X 10.8.5. What version of OS X are you running?^C
for me, either.^C
in older versions?