我正在 shell 腳本中執行以下 curl 命令。但我收到命令未找到錯誤。所以想檢查我在執行它時是否犯了任何錯誤。
return = $(curl -s --location --request GET --url 'https://testurl.mywebsite.com/api/accts?Id=trst_id&var=test_var' --header 'type: app/test')
echo "data is: ${return}"
我收到錯誤:
return: command not found
如果我嘗試執行 curl 命令的方式有問題,請告訴我。
謝謝你。
uj5u.com熱心網友回復:
就像 dan 在評論中指出的那樣,變數和命令之間的額外空格導致了這個問題。洗掉多余的空格后,它起作用了。
return=$(curl -s --location --request GET --url 'https://testurl.mywebsite.com/api/accts?Id=trst_id&var=test_var' --header 'type: app/test') echo “資料是:${return}”
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/367016.html
