difference between -e and -f option in "if statement" in korn
- From: rachit7@xxxxxxxxx
- Date: Fri, 03 Aug 2007 12:36:14 -0700
All,
What is the difference between the followig two chunks of code:
if [ -e /var/mail/root ] # Here /var/mail/root is
just an example file.....it can be anything.
then
echo true
else
echo false
fi
if [ -f /var/mail/root ]
then
echo true
else
echo false
fi
Actually, I was using the first one ( -e ) in my shell script to
check the existance of some files and it was working perfectly fine.
Suddenly after couple of days same script gives me error this error:
../myscript.ksh[618]test: agrument expected
Here 618 is the line number where I am using if statement. The script
gives me line numbers everytime it finds
" if statement " with -e option.
After spending some time I realized that -f will also do the same
task. So I changed everything from -e to -f.
But I am curious about this behavior .....it was working perfectly
fine before and suddenly these errors came......
Any ideas??
Regards,
RB
.
- Follow-Ups:
- Re: difference between -e and -f option in "if statement" in korn
- From: Janis Papanagnou
- Re: difference between -e and -f option in "if statement" in korn
- Prev by Date: Re: script to generate names ???
- Next by Date: Re: difference between -e and -f option in "if statement" in korn
- Previous by thread: Determining real user access permissions to files/directories (ls -l doesn't help)
- Next by thread: Re: difference between -e and -f option in "if statement" in korn
- Index(es):
Relevant Pages
|