2016-08-16 42 views
0

我想在shell脚本中运行hive查询。如果我的配置单元查询失败,我想退出shell脚本并抛出错误。 现在,即使我的配置单元查询失败,接下来的步骤也会执行。有人可以帮助解决这个:shell脚本中的hive查询

VAL = hive -e " select col1 from table_name;" (假设表只有一行)

回声“如果蜂巢失败不跑”

+0

怎么样使用的Oozie的工作流程配置单元命令执行和处理失败 - https://gist.github.com/tmusabbir/7019600 – Aditya

回答

1
hive -e "select col1 from table_name" 

if test $? -ne 0 
then 
    exit 1 
fi