The "simplest endless loop" of shell script programming programmers in linux all know shell scripts. Even if you are not familiar with them, you should have heard of them!
So how to write an endless loop in a shell script? Www.2cto.com for those familiar with C language, the simplest endless loop should be written like this: ------------------------------------------------------------ while (1) {// do something} --------------------------------------------------------------- or you can use the for statement and do... the while statement! But how do I write an endless loop in a shell script? Www.2cto.com is a shell-unfamiliar ape. I believe this problem will be difficult for everyone. It has been a problem for me ...... I suddenly realized that I had accessed some information on the Internet and google! It can be written like this: When while ["1" = "1"] do # do somethingdone then or when while test "1" = "1" do # do somethingdone then maybe, you may think it's a little different from the C language! But please note that this is a script! You may know how to write an endless loop in shell, but is this really the simplest endless loop? Actually not! The simplest endless loop should be written in this way. (Note: I call it the simplest here, and it may be simple !) Www.2cto.com when: do # do somethingdone when you see this, maybe you will be bored, what is this thing, and even suspect that I am in the "big step" ----- "nonsense", in fact, my step is very small, and I can't find it! Yes, this is indeed an endless loop. If you don't believe it, you can try it! Note "#" the meaning of this line is commented in shell, #! /Bin/sh and ":" empty statement in shell, that is, nothing is done! It is equivalent to ";"! Well, I will write it here! Thank you!