3 ms·
It's not really a loop, it's the second half of the REISUB magic sequence (https://en.wikipedia.org/wiki/Reisub?skin=timeless#Uses https://en.wikipedia.org/wiki
by tremon 3y ago
It's not really a loop, it's the second half of the REISUB magic sequence (https://en.wikipedia.org/wiki/Reisub?skin=timeless#Uses https://en.wikipedia.org/wiki/Reisub?skin=timeless#Uses):
- switch keyboard to _r_aw mode
- gracefully t_e_rminate all processes
- k_i_ll all remaining processes
- _s_ync filesystems
- _u_nmount filesystems
- re_b_oot
You need the "loop" to feed the characters one-by-one to /proc/sysrq-trigger.
- e40 3y agoHere I thought "for" was a loop. Thanks for the explanation what the "sub" did (and more).
- yjftsjthsd-h 3y agoSo the thing to remember is that in POSIX shell (and BASH, etc.) all for loops are for-each loops. If you wanted to loop over integers, you might write `for i in $(seq 10); do echo $i; done`, but that just turns into `for i in 1 2 3 4 5 6 7 8 9 10; do echo $i; done` when it runs. So this one just iterates over "s", "u", and "b" instead.
- e40 3y agoBruh. The mansplaining over the word "loop" is insane.