filenname="/home/sxxxx/lob.oaxxx"
while read a b
do
mdate=$(date -d "$b" +'%s')
system_todate=$(date +'%s')
((diff=$system_todate-$mdate))
days=`echo "$diff/86400" | bc`
echo "$(date +%Y-%m-%d) $a $b $days"
$mysql -e "insert into dataStagDatabase.dataStagTable (as_on_date, hdfs_location, last_modified, no_of_days) values (STR_TO_DATE('$(date +%Y-%m-%d)','%Y-%m-%d'), '$a', STR_TO_DATE('$b', '%Y-%m-%d' )", '$days');" -u root
done < "$filenname"
我收到以下错误,我尝试以各种方式修改插入语句,但无法成功。 请帮助
oaisys_datastag.sh: line 19: syntax error near unexpected token `)'
oaisys_datastag.sh: line 19: `mysql -e "insert into dataStagDatabase.dataStagTable (as_on_date, hdfs_location, last_modified, no_of_days) values (STR_TO_DATE($(date +%Y-%m-%d),'%Y-%m-%d'), $a, STR_TO_DATE($b, '%Y-%m-%d' )", $days);" -u root '
答案 0 :(得分:1)
在倒数第二行,你有一个开放"
和两个关闭"
。使报价保持一致,并将其配对。 - 保罗L