There is so much knowledge around us and it is growing at such a rapid pace that human beings are no longer capable of keeping everything in their brain let alone remember the important things when required. My interests in a variety of fields ranging from technology, finance, law, world affairs to my childhood interest in Sanskrit and my hobbies has always stimulated my desire to study and get to know about various topics related to these fields. I strive to understand diverse aspects and different viewpoints and also try to develop my opinion based on the knowledge that I have gained and from experiences of people around me. Generally, your understanding of the topic improves by writing about and explaining it to a layman in simplest of words. I would be working to improve my knowledge of various topics and hope to give you simplistic content to read and enjoy.
One of the first rules that is taught in any programming course is that 0 means False and anything that is non-zero is considered True. But when you come to system programming in Unix environment, you need to completely forget this basic programming rule. In unix shells, this rule is flipped and 0 means true / success while anything non-zero means false / failure. Every executed command in unix shells returns an exit status according to this convention. Let's see some examples in bash We will use the echo $? to get the exit status for the previously executed command. (The detailed explanation of this command is out of the scope of this article) The first example is as always to print "Hello World!" There are two ways of printing "Hello World!" as shown above. In both the cases, the exit status is 0 as the printing is successful. Let's check the true and false variables. As you can see, false returns 1. Another example using conditionals. ...
Comments
Post a Comment