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
Csh to check for existence of file Raynon Shell Programming and Scripting 9 12-05-2007 09:20 PM
Checking the existence of a file.. igandu Shell Programming and Scripting 7 06-13-2007 03:47 AM
checking file existence DILEEP410 Shell Programming and Scripting 3 01-24-2007 12:43 PM
File existence mpang_ Shell Programming and Scripting 2 03-27-2006 11:27 AM
Loop for file existence bd_joy UNIX for Dummies Questions & Answers 2 02-02-2006 12:51 PM

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 05-15-2006
anormal anormal is offline
Registered User
  
 

Join Date: May 2006
Posts: 2
File existence problem

I have a problem with file existence in shell. that is the code..

#!/bin/sh
if [-f example.txt]
then
echo "File Exist!!"
else
echo "Error"
fi

but it gives an error in 2nd line. Did i write example.txt wrong? Is there any (`) or (") missing? or something like that?
  #2 (permalink)  
Old 05-15-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,100
You need blanks before and after [ and ]
  #3 (permalink)  
Old 05-15-2006
anormal anormal is offline
Registered User
  
 

Join Date: May 2006
Posts: 2
Thank you so much Perderabo. It's ok now..
Sponsored Links
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 09:11 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