Re: Why does 'test -f' and 'test -e' return true on a (hidden) file that doesn't exist?

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



Tim Alberts wrote:
Why does 'test -f' and 'test -e' return true on a (hidden) file that doesn't exist?

*> cat /home/talberts/.forward*
cat: /home/talberts/.forward: No such file or directory
*> test -f /home/talberts/.forward ;echo $?*
1
*> test -e /home/talberts/.forward ;echo $?*
1


_______________________________________________
It doesn't:

[root@gandalf ~]# cat /tmp/.test1
test1
[root@gandalf ~]# test -f /tmp/.test1 ; echo $?*
0*
[root@gandalf ~]# test -f /tmp/.test1 ; echo $?
0

[root@gandalf ~]# cat /tmp/.test2
cat: /tmp/.test2: No such file or directory
[root@gandalf ~]# test -f /tmp/.test2 ; echo $?
1
[root@gandalf ~]# test -e /tmp/.test2 ; echo $?
1
[root@gandalf ~]#

--

Kind Regards
Rudi Ahlers
CEO, SoftDux

Web:   http://www.SoftDux.com
Check out my technical blog, http://blog.softdux.com for Linux or other technical stuff, or visit http://www.WebHostingTalk.co.za for Web Hosting stuff

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux