在执行脚本的时候出现这样的报错,是什么问题引发的?
docker安装没有执行下面的部分吧
仔细看,就是这个原因导致的,这个问题有类似帖子,可以搜到的
我使用的是composer安装,没有用docker安装
@resetl #4楼 操作系统呢?centos?
@Fecshop #5楼 是的 centos
把执行这个脚本,完整的log贴上来
https://github.com/fecshop/yii2_fecshop/blob/master/shell/urlRewrite.sh
信息写全,否则不好诊断问题。
#!/bin/sh Cur_Dir=$(cd `dirname $0`; pwd) # init full search collection indexes. $Cur_Dir/../../../../yii product/search/initindex # get now update timestamp. nowtime=`$Cur_Dir/../../../../yii helper/urlrewrite/nowtime` # 1.Product 遍历所有产品,把product的url_key 写入到url rewrite # get product all count. count=`$Cur_Dir/../../../../yii helper/urlrewrite/productcount` pagenum=`$Cur_Dir/../../../../yii helper/urlrewrite/productpagenum` echo "There are $count products to process" echo "There are $pagenum products pages to process" echo "##############ALL BEGINING###############"; for (( i=1; i<=$pagenum; i++ )) do $Cur_Dir/../../../../yii helper/urlrewrite/product $i echo "Page $i done" done
你打开这个脚本,$pagenum变量是上面的那个命令行返回的
$pagenum
pagenum=`$Cur_Dir/../../../../yii helper/urlrewrite/productpagenum`
你执行以下 ../../../../yii helper/urlrewrite/productpagenum 看看返回结果, 这样调试以下,就知道问题了。
../../../../yii helper/urlrewrite/productpagenum
出现问题,先看源码自己尝试解决。
There are 42 products to process There are 1 products pages to process ##############ALL BEGINING############### urlRewrite.sh: line 17: ((: i<=1: syntax error: operand expected (error token is "1") There are 31 categorys to process There are 1 categorys pages to process ##############ALL BEGINING############### urlRewrite.sh: line 33: ((: i<=1: syntax error: operand expected (error token is "1") ##############ALL COMPLETE###############
我没有遇到这个问题,你百度查查这个报错吧
你是不是改动这个sh代码了、、、
这个问题之前从没有人出过
系统文件我不会动的,好的 我查查
我试了一下,没有问题:
[root@iZ942k2d5ezZ shell]# sh urlRewrite.sh There are 43 products to process There are 1 products pages to process ##############ALL BEGINING############### Page 1 done There are 31 categorys to process There are 1 categorys pages to process ##############ALL BEGINING############### Page 1 done ##############ALL COMPLETE############### [root@iZ942k2d5ezZ shell]#
你按照 #8 的方式,试一下,看看输出, 另外,你用vi -b 的方式打开urlRewrite.sh,看看是否有 ^M,这种特殊的不可见字符等等,你查下资料自己尝试解决试试,我没有这个报错,不好诊断
vi -b
^M