I have some confusion in how following expression works.
cc file_name.c && ./a.out
When filename.c gets compiled successfully , its exist status would be 0 (zero). So as per logical && operation , second expression ( ./a.out ) not suppose to be executed. But it still works and gives me result. How it works ?
Thanks
0
means success in the shell. It's not the same as in C. From the bash
man page:
AND and OR lists are sequences of one of more pipelines separated by the && and ││ control operators, respectively. AND and OR lists are executed with left associativity. An AND list has the form
command1 && command2
command2 is executed if, and only if, command1 returns an exit status of zero.