我正在嘗試連接到 Neptune DB 并使用 CURL 命令獲取頂點詳細資訊。我有它的shell腳本。但不知何故,變數資料并沒有通過 gremlin 查詢。我有一個 Orgid.txt 檔案,其中存在tenantid,我的 shell 腳本讀取該檔案并將其傳遞給“name”變數
#!/bin/bash
i=1
rm VerticesCount1
while IFS= read -r line
do
name="$line"
#echo "Orgid name is "$i": $name"
curl -X POST https://<Neptune_endpoint>:<port>/gremlin -d '{"gremlin":"g.V().has(\"system.tenantId\",\"$name\").count()"}' >> VerticesCount1
#printf "\n"
echo >> VerticesCount1
((i=i 1))
done < Orgid.txt
uj5u.com熱心網友回復:
和你的其他問題一樣,我用一個簡單的資料檔案進行了測驗,它作業正常。但是,請注意我是如何更改curl.
i=1
while IFS= read -r line
do
name="$line"
curl -X POST https://mydbcluster.cluster-xxxxxxxxxxxx.us-east-1.neptune.amazonaws.com:8182/gremlin -d \
"{\"gremlin\":\"g.V().has('code','$name').count()\"}"
((i=i 1))
done < values.txt
產生
{"requestId":"4e3e80ed-efcb-40a7-b92b-366c6f391d4e","status":{"message":"","code":200,"attributes":{"@type":"g:Map","@value":[]}},"result":{"data":{"@type":"g:List","@value":[{"@type":"g:Int64","@value":1}]},"meta":{"@type":"g:Map","@value":[]}}}{"requestId":"6a269b5b-32f6-49d2-a31d-c51dd52eba29","status":{"message":"","code":200,"attributes":{"@type":"g:Map","@value":[]}},"result":{"data":{"@type":"g:List","@value":[{"@type":"g:Int64","@value":1}]},"meta":{"@type":"g:Map","@value":[]}}}
uj5u.com熱心網友回復:
使用此代碼可以正常作業。
while IFS= read -r line
do
name="$line"
#echo "Orgid name is "$i": $name"
curl -X POST https://<Neptune_endpoint>:<port>/gremlin -d '{"gremlin":"g.V().has(\"system.tenantId\",\"'$name'\").count()"}' >> VerticesCount1
echo >> VerticesCount1
done < Orgid.txt
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/347675.html
上一篇:422發布帶有請求的檔案時
