[英]bash arguments list too long on linux but not on mac
这是我运行的shell脚本:
for file in “$d/resources/“*; do
resourceName=$(basename $file)
echo “Inserting resouce: $resourceName...”
resource=`cat $file`
# Generate id with md5
resourceId=$((resourceId+1))
# Insert into resources table
cqlsh -e “INSERT INTO $TENANT_NAME.resources (id, target,lastUpdateDate,lastUpdateUser,algorithmName,resourceName,resourceContent) VALUES ( $resourceId, ‘template’, toTimestamp(now()), null, ‘$algorithmName’, ‘$resourceName’, \$\$$resource\$\$);” $STORAGE_HOST_ADDRESS $STORAGE_HOST_PORT
done
在Mac上,它工作正常,但在Linux上,由于$ resource,它抛出错误bash参数列表的时间太长了。 有人可以告诉如何解决此问题吗? 谢谢。
Linux每个参数限制为128k。 macOS的参数+环境限制为256k。
而是将查询写入文件,并让cqlsh
而不是环境执行该查询:
cqlsh -f myqueryfile host port
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.