簡體   English   中英

如何編寫 shell 腳本以從文件中為 arguments 調用 function?

[英]How to write shell script for chaincode invoke function for arguments from file?

我想使用 bash 腳本和 arguments 調用鏈碼自動寫入 10 條記錄的數據,鏈碼可以從 txt 文件中獲取。但是,鏈碼不會從文件寫入分類帳,它只寫入值“line1”和“line2” ”。

#!/bin/bash while read -r line1 <&3 && read -r line2 <&4; do
peer chaincode invoke -c '{"Args":["createDocRecord", "$line1" , "$line2"]}' -o orderer.example.com:7050 -C bloom-filter-channel -n bloom-filter --peerAddresses peer0.org2.example.com:9051  done 3<scripts/10.txt 4<scripts/data10.txt`

為什么它不從 txt 文件中獲取字符串值?

嘗試設置超時。 您可能正在運行調用,而第一個事務尚未驗證和提交,我不知道您是如何配置網絡的。

所以做一些類似的事情:

peer chaincode invoke -c '{"Args":["createDocRecord", "$line1" , "$line2"]}' -o orderer.example.com:7050 -C bloom-filter-channel -n bloom-filter --peerAddresses peer0.org2.example.com:9051  done 3<scripts/10.txt 4<scripts/data10.txt`

timeout 5

repeat

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM