Shell script “for” loop syntax

Brace expansion, {x..y} is performed before other expansions, so you cannot use that for variable length sequences. Instead, use the seq 2 $max method as user mob stated. So, for your example it would be:

wait(null) and wait(&status) C language and Status

If you call wait(NULL) (wait(2)), you only wait for any child to terminate. With wait(&status) you wait for a child to terminate but you want to know some information about it’s termination. You can know if the child terminate normally with WIFEXITED(status) for example. status contains information about processes that you can check with some already defined MACRO.

What does it mean to write to stdout in C?

That means that you are printing output on the main output device for the session… whatever that may be. The user’s console, a tty session, a file or who knows what. What that device may be varies depending on how the program is being run and from where. The following command will write to the … Read more

What does ^M character mean in Vim?

Unix uses 0xA for a newline character. Windows uses a combination of two characters: 0xD 0xA. 0xD is the carriage return character. ^M happens to be the way vim displays 0xD (0x0D = 13, M is the 13th letter in the English alphabet). You can remove all the ^M characters by running the following: Where ^M is entered by holding down Ctrl and … Read more

Display exact matches only with grep

You need a more specific expression. Try grep ” OK$” or grep “[0-9]* OK”. You want to choose a pattern that matches what you want, but won’t match what you don’t want. That pattern will depend upon what your whole file contents might look like. You can also do: grep -w “OK” which will only match a whole word “OK”, … Read more