Assigning the output of a C program in unix shell script and checking the value -


let's have c program evaluates either 0 or non 0 integer; program evaluates boolean value.

i wish write shell script can find out whether c program evaluates 0 or not. trying assign return value of c program variable in shell script seem unable so. have;

#!/bin/sh variable=/path/to/executable input1 

i know assigning values in shell script requires not have spaces, not know way around this, since running seems evaluate error since shell interprets input1 command, not input. there way can this?

i unsure how check return value of c program. should use if statement , check if c program evaluates value equal 0 or not?

this basic

#!/bin/sh variable=`/path/to/executable input1` 

or

#!/bin/sh variable=$(/path/to/executable input1) 

and return code program use

echo $? 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -