Shell 检查文件是否存在于ksh中
在测试中的ksh手册中,有检查文件是否存在的Shell 检查文件是否存在于ksh中,shell,ksh,Shell,Ksh,在测试中的ksh手册中,有检查文件是否存在的-a和-e标志。我想知道他们之间是否有任何区别,如果有,在什么情况下哪一个更可取?情况取决于你在寻找什么。您将对这些旗帜感兴趣: a -- not really a file test: it's the "and" conjunction. d -- it is a directory e -- it exists f -- it is an ordinary file s -- it exists and non-zero size
-a
和-e
标志。我想知道他们之间是否有任何区别,如果有,在什么情况下哪一个更可取?情况取决于你在寻找什么。您将对这些旗帜感兴趣:
a -- not really a file test: it's the "and" conjunction.
d -- it is a directory
e -- it exists
f -- it is an ordinary file
s -- it exists and non-zero size
您想搜索UNIX手动测试的完整列表。无论如何,在不同的文件和目录上练习。情况取决于你在寻找什么。您将对这些旗帜感兴趣:
a -- not really a file test: it's the "and" conjunction.
d -- it is a directory
e -- it exists
f -- it is an ordinary file
s -- it exists and non-zero size
您想搜索UNIX手动测试的完整列表。无论如何,在不同的文件和目录上练习。都将-a和-e定义为对文件存在性的测试,并且在功能上是相同的。根据我的经验,-f在大多数情况下使用,因为编码人员不仅需要测试存在性,还需要测试文件类型 将-a和-e定义为对文件存在性的测试,它们的功能相同。根据我的经验,-f在大多数情况下使用,因为编码人员不仅需要测试存在性,还需要测试文件类型