gpt4 book ai didi

linux - bash 参数列表在 Linux 上太长,但在 Mac 上则不然

转载 作者:太空宇宙 更新时间:2023-11-04 04:51:52 25 4
gpt4 key购买 nike

这是我运行的 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

关于linux - bash 参数列表在 Linux 上太长,但在 Mac 上则不然,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56026548/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com