我正在尝试使用 curl 删除一些对象。我有一个文件中的 onjects 的 id 列表。我遍历列表并发出这样的 del :
bash -x del.sh tempId.log
+ read id
+ curl -H 'Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA' -X DELETE https://url/id
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]+ read id
+ curl -H 'Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA' -X DELETE https://url/id
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]+ read id
+ curl -H 'Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA' -X DELETE https://url/id
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]+ read id
+ curl -H 'Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA' -X DELETE https://url/id
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]+ read id
+ curl -H 'Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA' -X DELETE https://url/id
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]+ read id
+ curl -H 'Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA' -X DELETE https://url/id
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]+ read id
+ curl -H 'Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA' -X DELETE https://url/id
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]+ read id
+ curl -H 'Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA' -X DELETE https://url/id
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]+ read id
+ curl -H 'Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA' -X DELETE https://url/id
[{"message":"Session expired or invalid","errorCode":"INVALID_SESSION_ID"}]+ read id
这是脚本
#!/bin/bash
while read id; do
curl -H "Authorization:OAuth 00D30000001FxvA%21AQEAQKkcrruykRDNDapigaEdJXOc4SS_D27o686DScK8pU22BeMsgWVsWJ.Nv0DXimx2zBFKYlAUeDnGgokY2pU8m9xMoe73&apv=1&cshc=0000004qUmq0000001FxvA" -X DELETE https:url/$id
done <$1
但是,如果我在终端上运行相同的 curl 命令,它可以正常工作!
有什么建议么?
谢谢!