判断hdfs文件是否存在

#!/bin/bash
HADOOP=$(which hadoop)
$HADOOP fs -test -e $1
if [ $? -eq 1 ]
then
$HADOOP fs -put $1 /
if [ $? -eq 0 ]
then
echo "the file $1 put successfully!"
fi
fi

posted @ 2018-05-05 18:10  瓶子xf  阅读(686)  评论(0编辑  收藏  举报