gpt4 book ai didi

bash - 如何使用HDFS Shell脚本处理--config选项

转载 作者:行者123 更新时间:2023-12-02 21:18:29 27 4
gpt4 key购买 nike

当我运行${HADOOP_HDFS_HOME}/bin/hdfs --config ${HADOOP_CONF_DIR} dfs -ls /时,hdfs shell脚本如何处理--config选项?

脚本不比较"COMMAND" = "--config",尽管COMMAND是COMMAND=$1
hdfs shell script is here

COMMAND=$1

最佳答案

选项--confighadoop-config.sh脚本中处理,该脚本由hdfs-config.sh脚本调用,该脚本又由hdfs调用:

#check to see if the conf dir is given as an optional argument
if [ $# -gt 1 ]
then
if [ "--config" = "$1" ]
then
shift
confdir=$1
if [ ! -d "$confdir" ]; then
echo "Error: Cannot find configuration directory: $confdir"
exit 1
fi
shift
HADOOP_CONF_DIR=$confdir
fi
fi

您只需要深入研究脚本链。

关于bash - 如何使用HDFS Shell脚本处理--config选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38091051/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com