Advertisement

01.13.2003 at 05:08AM PST, ID: 20454409
[x]
Attachment Details

check if file exists ?

Asked by chipowski in Unix Operating Systems

Tags: file, exists, check

i am trying to check if a file exists before continuing with my script but it is not working.

if [ -e $filename ]
then
file_menu    #calls the function file_menu if file exists
else
echo data file does not exist
fi

i have put in dummy file names but it always calls the function. it seems to ignore that file does not exist.
can anyone help?
i am using korn shell.Start Free Trial
[+][-]01.13.2003 at 05:54AM PST, ID: 7717056

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Unix Operating Systems
Tags: file, exists, check
Sign Up Now!
Solution Provided By: yuzh
Participating Experts: 2
Solution Grade: A
 
 
[+][-]01.13.2003 at 06:43AM PST, ID: 7717392

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.13.2003 at 07:28AM PST, ID: 7717685

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32