Operating System - HP-UX
1833476 Members
2891 Online
110052 Solutions
New Discussion

meaning of -a operator in 'if' statement

 
SOLVED
Go to solution
u856100
Frequent Advisor

meaning of -a operator in 'if' statement

all,

Could someone confirm what the -a coperator is used for in UNIX scripting apart from 'logical AND'?

I am reading a script where I have a test for file existance, i.e. :

if [[ ! -a ./myfile ]]

I am curious as to why -a is used and not -f, as I thought -a was purely JUST logical AND and not a file existance test operator?

any help much appreciated!

thanks!
John
chicken or egg first?
2 REPLIES 2
Leif Halvarsson_2
Honored Contributor
Solution

Re: meaning of -a operator in 'if' statement

Hi,

In ksh -a is the same as -e, -a is obsolete and perhaps for backward compatiblity.
Pete Randall
Outstanding Contributor

Re: meaning of -a operator in 'if' statement

As Leif said - same as -e (exists).

Pete

Pete