curl を使用していくつかのオブジェクトを削除しようとしています。ファイル内のオブジェクトの 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 コマンドを実行すると、正常に動作します。
助言がありますか?
ありがとう!