如何捕获我在Shell脚本中执行的Beeline命令的返回码。如下:
beeline -u $ Beeline -e“ALTER TABLE DROP if exists partition(date ='');”
我想在shell脚本中捕获上述查询的状态。
谢谢AG
$?
捕获前一个语句的返回码。将结果存储在变量中或使用$?
以便稍后进行更多处理。
beeline -u $Beeline -e "ALTER TABLE DROP if exists partition (date='');"
rc=$?
#do whatever with $rc here