测试-h和测试-L之间的区别 [英] Difference between test -h and test -L
本文介绍了测试-h和测试-L之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在ksh shell中,test -L filename
和test -h filename
之间有什么区别.在手册页中,这两个都用于标识符号链接,但是我想知道确切的区别.
What is the difference between test -L filename
and test -h filename
in ksh shell. From the man page, both were used to identify a symbolic link, but I want to know the exact difference.
这是手册页中的描述.
-h file True if file exists and is a sym-
bolic link.
-L file True if file exists and is a sym-
bolic link.
推荐答案
文件bltins/test.c
中ksh93
的源代码显示这两个选项的处理方式完全相同,除了作者对未来的希望之外:
The source code for ksh93
, in file bltins/test.c
, shows that these two options are treated exactly the same, except for the author's hopes for the future:
case 'L':
case 'h': /* undocumented, and hopefully will disappear */
if(*arg==0 || arg[strlen(arg)-1]=='/' || lstat(arg,&statb)<0)
return(0);
return(S_ISLNK(statb.st_mode));
据此我得出结论,它们的行为完全相同,但是-h
是一种遗留选项,可能有一天会消失:-)
From this I conclude that they behave exactly the same, but that -h
is a legacy option and may one day disappear :-)
这篇关于测试-h和测试-L之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文