Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

to clean the command prompt line after CTRL-C:

    trap "{ echo; exit 1; }" INT


I don't know, if you're fearing a ctrl-c in the middle of one of those newfangled moving, colourized progress bars (hello, npm), "reset" might be more appropriate?


sure, if you do coloring/bold/underline/inverse in the script, reset would be appropriate. but I wouldn't do it by default, because it's quite slow ('time reset' takes 1s here)


"tputs reset" has much the same effect (I think; there are some cases I've noticed it not fully restoring things) without the delay.


My reset also takes suspiciously close to one second. Turns out it sleeps for one second at the end, probably to give the terminal time for something.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: