使用方法
hdfs dfs -test -[defswrz] <path> :
Answer various questions about <path>, with result via exit status.
-d return 0 if <path> is a directory.
-e return 0 if <path> exists.
-f return 0 if <path> is a file.
-s return 0 if file <path> is greater than zero bytes in size.
-w return 0 if file <path> exists and write permission is granted.
-r return 0 if file <path> exists and read permission is granted.
-z return 0 if file <path> is zero bytes in size, else return 1.
获取返回值
$?
[示例]
[root@emr-worker-2 ~]# hadoop fs -test -e /tmp
[root@emr-worker-2 ~]# echo $?
0
[root@emr-worker-2 ~]# hadoop fs -test -e /tmp1
[root@emr-worker-2 ~]# echo $?
1
查看方法
hdfs dfs -help
标签:hdfs,return,worker,Hadoop,dfs,file,test
From: https://www.cnblogs.com/144823836yj/p/17013040.html