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



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Search attributes in one structure using the values from another structure dhanamurthy High Level Programming 3 03-27-2008 03:37 AM
MV files from one directory structure(multiple level) to other directory structure srmadab UNIX for Advanced & Expert Users 4 09-13-2006 04:01 PM
Copying a Directory Structure to a new structure jhansrod UNIX for Dummies Questions & Answers 8 07-27-2005 06:24 AM
if then else structure props UNIX for Dummies Questions & Answers 4 12-27-2003 06:50 AM
Ram structure Dorian HP-UX 1 11-05-2002 09:48 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #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
  #2 (permalink)  
Old 11-22-2008
jlliagre jlliagre is offline Forum Advisor  
ɹǝsn sıɹɐlosuǝdo
  
 

Join Date: Dec 2007
Location: Paris
Posts: 1,265
Code:
grep -q 'santiago' file && echo text found || echo text not found
  #3 (permalink)  
Old 11-22-2008
chebarbudo's Avatar
chebarbudo chebarbudo is offline
Registered User
  
 

Join Date: Nov 2008
Location: various
Posts: 188
Humm... Sometimes I feel like digging a hole and burying myself.
Thanks jlliagre
Sponsored Links
Closed Thread

Bookmarks

Tags
conditions if statement, if then else

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0