小编CJ *_*ang的帖子

在 for 循环内卷曲 POST

以下适用于创建单个用户:

curl -X POST  --anyauth -u admin:admin --header "Content-Type:application/json" \
  -d '{"user-name":"joe",
       "password": "cool",
       "role": [ "rest-reader", "rest-writer" ]
      }' \
  http://localhost:8002/manage/v2/users
Run Code Online (Sandbox Code Playgroud)

但是在 for 循环中创建多个用户时失败了(一次一个)

for i in john frank bob
do
  curl -X POST  --anyauth -u admin:admin --header "Content-Type:application/json" \
  -d '{"user-name":"$i",
       "password": "$i",
       "role": [ "rest-reader", "rest-writer" ]
      }' \
  http://localhost:8002/manage/v2/users
done
Run Code Online (Sandbox Code Playgroud)

我哪里做错了?

shell-script curl

3
推荐指数
1
解决办法
922
查看次数

标签 统计

curl ×1

shell-script ×1