在我的 shell 脚本中,我使用这个查询来获取列 id 的 last_value。
last_val=`beeline -e "select nvl(max(id),0) from testing.1_test"`
结果是
+----------+--+
| _c0 |
+----------+--+
| 3380901 |
+----------+--+
现在我想将此值作为变量 ${last_val}
当我做回声时,${last_val}
我想拥有3380901
,但我正在接收
+----------+--+
| _c0 |
+----------+--+
| 3380901 |
+----------+--+
我怎么能回声3380901
。
当我使用下面的配置单元选项时,我得到了我想要的
last_val=`hive -e "select nvl(max(id),0) from testing.1_test"`
回声${last_val}
给了我3380901
请让我知道我该怎么做?