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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
conditional statement dr_sabz Shell Programming and Scripting 3 02-02-2009 08:01 AM
conditional statement lalelle Shell Programming and Scripting 8 08-21-2007 08:57 AM
quoting in conditional statement 3Gmobile Shell Programming and Scripting 2 08-14-2006 03:14 AM
awk conditional statement 3Gmobile Shell Programming and Scripting 10 08-09-2006 10:01 AM
more elegant way for conditional statement needed candyflip2000 Shell Programming and Scripting 3 05-18-2006 07:52 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-22-2009
dlafa dlafa is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 2
Unhappy Problem with conditional statement

Hi,

I'm getting a "bad number" error from the following conditional if statement. I understand the results of the grep command are not being treated a an integer but am unsure of the correct syntax. Any help would be appreciated.

if [ "grep -c DT $myoutfile" -gt 0 ]


Thanks
  #2 (permalink)  
Old 04-22-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,121
Code:
#!/bin/ksh

if [ $(grep -c DT "$myoutfile") -gt 0 ]
  #3 (permalink)  
Old 04-22-2009
dlafa dlafa is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 2
Thank you. That worked perfectly...
Closed Thread

Bookmarks

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 05:32 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
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