The UNIX and Linux Forums  

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
Conditonal clause in expect. akbar Shell Programming and Scripting 1 05-13-2008 04:28 PM
building a SET clause in shell script shalua Shell Programming and Scripting 14 04-10-2007 03:34 PM
why put double square brackets in an if clause? napolayan UNIX for Dummies Questions & Answers 5 11-16-2006 12:18 AM
if clause in AWK END block not working. satnamx Shell Programming and Scripting 1 04-21-2006 03:29 AM
GROUP BY clause functionality in a C Program avdtech High Level Programming 2 03-08-2005 07:40 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 08-08-2007
Registered User
 

Join Date: Aug 2007
Posts: 7
if clause

hi,
pls could you help me with one program in KSH ( i have sunOS).
I need to create an If clause, that prints an error message and filenames, when in a directory are found some files of null size (find . -type f -size 0 ).

thanks
Reply With Quote
Forum Sponsor
  #2  
Old 08-08-2007
Registered User
 

Join Date: Jul 2007
Posts: 5
if [ -s abcd.txt ];then
echo "non empty"
else
echo "empty"
Reply With Quote
  #3  
Old 08-08-2007
Shell_Life's Avatar
Registered User
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Foogle, you are missing an 'fi' in your 'if' statement.

In any event, the OP wants to inquire a directory for zero length files:
Code:
for mZeroFile in `find . -type f -size 0`
do
  echo 'Empty file = '${mZeroFile}
done
Reply With Quote
  #4  
Old 08-08-2007
Registered User
 

Join Date: Aug 2007
Posts: 7
thank you, this works good
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:36 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0