The Tuesday 2005-02-22 at 15:41 -0800, Randall R Schulz wrote:
I think it is not really a loop, only a "cute" way of chaining if/then/else sentences.
Yes, you're right, of course. Too cute by half, I'd say, but I suppose that's just because it fooled me.
Mee to. I had to stop and look at it carefully, after you mentioned it.
Let me see... the "set" line I don't understand, but the runlevel comand "prints the previous and current system runlevel on its standard output, separated by a single space. If there is no previous system runlevel, the letter N will be printed instead". Ah, it sets the first parameter to "N" and the second ${2} to "5" in my system.
Set does dual duty. It can change shell options and it can set the positional parameters. It's the latter use being made in this case. The previous and current run levels become $1 and $2, as you note.
Yes, it is a nice trick to separate words, easier and better than the program "cut" for that purpose, imo. I think you can redefine the word separator with an environment parameter change: there is at least one of the suse init scripts that uses that trick, if my memory serves. But the double dash still confuses me...
Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default), 'm' for minutes, 'h' for hours or 'd' for days. Unlike most implementations that require NUMBER be an integer, here NUMBER may be an arbitrary floating point number.
Note in particular the last sentence.
Yes, I use it fairly often. I didn't remember about the floating point, though. Funny, and interesting :-)
I'm not laughing. But I've found it to be handy.
I find funny those little differences beetween linux and "unixes". They are nice, but when we get back to another machine, it makes dificulties for us. -- Cheers, Carlos Robinson