bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-a broken, -e correct


From: Ross Vandegrift
Subject: -a broken, -e correct
Date: Tue, 29 Jul 2003 14:44:26 -0400
User-agent: Mutt/1.3.28i

It looks like [ -a foo ] and [ ! -a foo ] both return true when foo is a
file that exists.  -e doesn't exhibit this behavior, and -a behaves
correctly when the files doesn't exist:

ross@hex5:~/tmp$ bash --version
GNU bash, version 2.05b.0(1)-release (i386-pc-linux-gnu)
Copyright (C) 2002 Free Software Foundation, Inc.
ross@hex5:~/tmp$ rm -rf foo
ross@hex5:~/tmp$ if [ -a foo ]; then echo 1; fi
ross@hex5:~/tmp$ if [ ! -a foo ]; then echo 1; fi
1
ross@hex5:~/tmp$ touch foo
ross@hex5:~/tmp$ if [ -a foo ]; then echo 1; fi
1
ross@hex5:~/tmp$ if [ ! -a foo ]; then echo 1; fi
1
ross@hex5:~/tmp$ rm -rf foo
ross@hex5:~/tmp$ if [ -e foo ]; then echo 1; fi
ross@hex5:~/tmp$ if [ ! -e foo ]; then echo 1; fi
1
ross@hex5:~/tmp$ touch foo
ross@hex5:~/tmp$ if [ -e foo ]; then echo 1; fi
1
ross@hex5:~/tmp$ if [ ! -e foo ]; then echo 1; fi
ross@hex5:~/tmp$

Ross
-- 
Ross Vandegrift
ross@willow.seitz.com

A Pope has a Water Cannon.                               It is a Water Cannon.
He fires Holy-Water from it.                        It is a Holy-Water Cannon.
He Blesses it.                                 It is a Holy Holy-Water Cannon.
He Blesses the Hell out of it.          It is a Wholly Holy Holy-Water Cannon.
He has it pierced.                It is a Holey Wholly Holy Holy-Water Cannon.
He makes it official.       It is a Canon Holey Wholly Holy Holy-Water Cannon.
Batman and Robin arrive.                                       He shoots them.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]