LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-28-2013, 03:41 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Rep: Reputation: 33
How to set condition for found result?


Hi,

I am going to write a script. It will check if any file size greater than 10k, assumed. If yes, it will print out the result. If no, it will print out NOK.

The command is as follow:

Code:
find /var/log/jboss-apps/test -type f -size +10k
My script look as follow:
Code:
#!/bin/sh

result=$(find /var/log/jboss-apps/test -type f -size +10k)

echo RESULT=$result

if [[ $result -z ]]; then
  echo OK
else
  echo NOK
fi
But I got error:

Code:
RESULT=/var/log/jboss-apps/test/server.log.2013-10-24
./test.sh: line 10: conditional binary operator expected
./test.sh: line 10: syntax error near `-z'
./test.sh: line 10: `if [[ $result -z ]]; then'

Last edited by thomas2004ch; 10-28-2013 at 03:44 AM.
 
Old 10-28-2013, 03:48 AM   #2
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 537

Original Poster
Rep: Reputation: 33
I've solved the problem. Therer is error in the script.

Please don't reply my post anymore.

Last edited by thomas2004ch; 10-28-2013 at 04:07 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
check Negative egrep condition in an if condition novicunix Programming 5 02-02-2013 12:52 AM
kdevelop, debugging - how to set a valid condition for a watchpoint? onufry Programming 4 07-17-2009 01:32 PM
LQ Search result links cannot be found rnturn LQ Suggestions & Feedback 12 01-11-2008 05:11 PM
I can't believe it -- I just found a complete Win 3.11 install set! BinJajer General 9 02-05-2006 11:33 PM
result set Database problem dai Programming 8 04-11-2003 05:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration