这是我用来查询配置单元表的下面的 shell 脚本,我将此文件保存为test4.sh
#!/bin/bash
DATE_YEST_FORMAT1=`perl -e 'use POSIX qw(strftime); print strftime "%Y-%m-%d",localtime(time()- 3600*96);'`
echo $DATE_YEST_FORMAT1
QUERY1=`hive -e "
set mapred.job.queue.name=hdmi-technology;
SELECT split(ckey, '\\|') AS t1
,created_time
FROM (
SELECT CONCAT (
buyer_id
,'|'
,item_id
) AS ckey
,created_time
FROM dw_checkout_trans
WHERE to_date(from_unixtime(cast(UNIX_TIMESTAMP(created_time) AS BIGINT))) = '$DATE_YEST_FORMAT1' distribute BY ckey sort BY ckey
,created_time DESC
) a
WHERE rank(ckey) < 1;"`
问题陈述:-
我正在运行上面的 shell 脚本——
bash -x test4.sh
如果您在上面看到这一行hive sql query
:
**SELECT split(ckey, '\\|') AS t1**.
我是否需要转义斜杠符号才能使其在 shell 脚本中工作?