返回shell脚本中beeline命令的代码

问题描述 投票:0回答:1

如何捕获我在Shell脚本中执行的Beeline命令的返回码。如下:

beeline -u $ Beeline -e“ALTER TABLE DROP if exists partition(date ='');”

我想在shell脚本中捕获上述查询的状态。

谢谢AG

hadoop hive beeline
1个回答
0
投票

$?捕获前一个语句的返回码。将结果存储在变量中或使用$?以便稍后进行更多处理。

beeline -u $Beeline -e "ALTER TABLE DROP if exists partition (date='');"
rc=$?
#do whatever with $rc here
© www.soinside.com 2019 - 2024. All rights reserved.