hiveF 函数解析时间问题

#!/bin/bash
source /etc/profile
updatetime=`date --date='0 days ago' +“%Y-%m-%d %H:%M:%S"`
echo "updatetime: "${updatetime}
hiveF /auto_cron/cron-running/bidw/dms/hq_bi/11.sql -updatetime ${updatetime}  //传updatetime参数

相应SQL文件

select '${updatetime}' from dms.tracklog_5min where day='20161002' limit 1;

报错:时分秒没有显示出来

解决办法:

使用

hive -f /home/dp/1.sql -d updatetime="${updatetime}" //原始的传参数

相应的Sql

select "${updatetime}" from dms.tracklog_5min where day='20161002' limit 1;

原文地址:https://www.cnblogs.com/sunt9/p/6670321.html