Shell script to read value from a file and compare it to another one
        Posted  
        
            by 
                maneeshshetty
            
        on Super User
        
        See other posts from Super User
        
            or by maneeshshetty
        
        
        
        Published on 2011-11-18T06:14:52Z
        Indexed on 
            2011/11/18
            9:57 UTC
        
        
        Read the original article
        Hit count: 279
        
linux
|shell-script
I have a C program which puts one unique value inside a test file (it would be a two digit number). Now I want to run a shell script to read that number and then compare with my required number (e.g. 40). 
The comparison should deliver "equal to" or "greater".
For example: The output of the C program is written into the file called c.txt with the value 36, and I want to compare it with the number 40. 
So I want that comparison to be "equal to" or "greater" and then echo the value "equal" or "greater".
© Super User or respective owner