[英]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.