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

Also ^| (as in, "control pipe") which is a synonym for ^\. At least for me, | is faster to hit than \

And since we're on this topic: if I write a for loop in bash that runs a slow command 1000 times (ImageMagick comes to mind), and I realise something has gone wrong, is there an easy way of breaking the outer loop?



If you wrote the for loop interactively, you can suspend it with ^Z and kill its jobspec with 'kill %n' (for n usually = 1).

If it's part of a script, your script probably wants to trap SIGINT.


> Also ^| (as in, "control pipe") which is a synonym for ^\. At least for me, | is faster to hit than \

How? Do you have a keyboard where | isn't Shift+\?


I have a Norwegian keyboard, where as you can see, pipe has its own key to the left of "1" (above Tab):

https://en.m.wikipedia.org/wiki/File:Keyboard_Layout_Norwegi...


On a Swedish keyboard, | is altgr+< (between shift and z), and \ is altgr++ (between 0 and ´).


Not a nice way, but the way that works best for me is:

^Z

fg

^C

the ^Z kills the loop, the fg and ^C cleans up the currently running one.




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

Search: