使用shell脚本自动执行,向starrocks表中插入数据报错

【详述】使用shell脚本自动执行,向starrocks表中插入数据报错
【背景】shell脚本向starrocks表中插入数据,单独将脚本的sql在starrocks的客户端执行是没有问题的
【业务影响】
【StarRocks版本】2.5.2
【集群规模】3fe(1 follower+2observer)+3be(fe与be混部)
【联系方式】392388393@qq.com
【附件】
执行脚本时报错:
-bash: dim_users_unique: command not found
-bash: name: command not found
-bash: pwdRaw: command not found
-bash: regDate: command not found
-bash: realName: command not found
-bash: gender: command not found
-bash: birthday: command not found
-bash: isMarriaged: command not found
-bash: lastTime: command not found
-bash: isValid: command not found
-bash: diskSpaceAllowed: command not found
-bash: diskSpaceUsed: command not found
-bash: online_time: command not found
-bash: unit_code: command not found
-bash: isPass: command not found
-bash: last_login: command not found
-bash: login_account: command not found
-bash: account_type: command not found
-bash: wx_union_id: command not found
-bash: doc_comment_query_flag: command not found
-bash: ods_users_unique: command not found
ERROR 1064 (HY000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘select’ at line 1
脚本信息是:
#! /bin/bash

ods_to_dim.sh all/表名

#1、判断参数是否传入
if [ $# -lt 1 ]
then
echo “必须至少传入一个表名/all…”
exit
fi
#用户维度表sql语句
dim_users_unique_sql="
insert into dim_users_unique
SELECT
id,
name,
pwd,
pwdRaw,
regDate,
realName,
gender,
birthday,
isMarriaged,
lastTime,
isValid,
diskSpaceAllowed,
diskSpaceUsed,
online_time,
unit_code,
isPass,
last_login,
login_account,
account_type,
wx_union_id,
doc_comment_query_flag
from ods_users_unique;
"
#2、根据第一个参数匹配加载
case $1 in
“all”)
mysql -uroot -h172.30.16.26 -P 19030 -e “use test_house;${dim_users_unique_sql};”
;;
“dim_users_unique”)
mysql -uroot -h172.30.16.26 -P 19030 -e “use test_house;${dim_users_unique_sql};”
;;
*)
echo “表名传入错误…”
;;
esac

mysql -uroot -h172.30.16.26 -P 19030这个命令在客户端是可以直接登录starrocks的

将脚本的``(飘号)删除就可以了,为什么呢

飘号是对中间的字符串进行转义,您的这个脚本里也没见又飘号啊

#! /bin/bash

ods_to_dim.sh all/表名

飘号识别不了

#1、判断参数是否传入
if [ $# -lt 1 ]
then
echo “必须至少传入一个表名/all…”
exit
fi
#用户维度表sql语句
dim_users_unique_sql="
insert into dim_users_unique
SELECT
id,
name,
pwd,
pwdRaw,
regDate,
realName,
gender,
birthday,
isMarriaged,
lastTime,
isValid,
diskSpaceAllowed,
diskSpaceUsed,
online_time,
unit_code,
isPass,
last_login,
login_account,
account_type,
wx_union_id,
doc_comment_query_flag
from ods_users_unique;
"
#2、根据第一个参数匹配加载
case $1 in
“all”)
mysql -uroot -h172.30.16.26 -P 19030 -e “use test_house;${dim_users_unique_sql};”
;;
“dim_users_unique”)
mysql -uroot -h172.30.16.26 -P 19030 -e “use test_house;${dim_users_unique_sql};”
;;
*)
echo “表名传入错误…”
;;
esac
一开始是有加飘号的,而且在客户端执行有加飘号也是没有问题的,但是写入脚本就不行了

我粘贴上来的是有飘号的,但是现在显示的时候没有飘号,但是在shell脚本时有飘号的一开始

而且我hive的shell脚本有加飘号是可以正常运行的

您后发的我这边也看不到,截个图看下?

还有starrocks的这个问题( 向starrocks写入数据,如果一行数据过多null,报错),您可以帮我看一下是什么原因吗

您好,这个问题使用shell脚本自动执行,向starrocks表中插入数据报错是shell问题,不是starrocks的问题,谢谢您的耐心解答.