The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 09-13-2007
porter porter is offline
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by bluemoon1 View Post
However, I failed to make it to check if it is non-zero- tried a few syntax with no luck... such as: if [ ! domything ], if [ domything -ne 0 ].... can you make it?;-)
No alas, I haven't. However some programs can reverse the return code, eg grep with the -v option.

There is a program called "true" and one called "false", there should be one called "not"....

Code:
#!/bin/sh
if $@
then 
    exit 1
fi
exit 0
then you could do

Code:
if not myprogram
then
.....
Reply With Quote