The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-22-2008
chebarbudo's Avatar
chebarbudo chebarbudo is offline
Registered User
  
 

Join Date: Nov 2008
Location: various
Posts: 188
Question condensed if then structure

Hi all,
I was wondering if it was possible to put a command in an if statement.
I wrote something like:
Code:
grep -q 'santiago' file
(( $? )) && echo text not found || echo text found
I would like to write something like this but it doesn't work:
Code:
(( grep -q 'santiago' file )) && echo text not found || echo text found
Do you have any clue?
Thanks in advance
Santiago