Let's say I have a C program that evaluates to either a zero or non zero integer; basically a program that evaluates to a boolean value.
I wish to write a shell script that can find out whether the C program evaluates to zero or not. I am currently trying to assign the return value of the C program to a variable in a shell script but seem to be unable to do so. I currently have;
#!/bin/sh
variable=/path/to/executable input1
I know that assigning values in shell script requires us not to have spaces, but I do not know another way around this, since running this seems to evaluate to an error since the shell interprets input1 as a command, not an input. Is there a way I can do this?
I am also unsure as to how to check the return value of the C program. Should I just use an if statement and check if the C program evaluates to a value equal to zero or not?