Guest User

Untitled

a guest
Sep 19th, 2018
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.11 KB | None | 0 0
  1. [root@localhost tmp]# cat 52399819.sh      
  2. getserver() {
  3.   curl -X GET http://localhost:8000/json52399819.json
  4. }
  5.  
  6. servers=$(getserver)
  7. echo $servers | jq .
  8.  
  9.  
  10. [root@localhost tmp]# curl -X GET http://localhost:8000/json52399819.json
  11. {
  12.                 "age":100,
  13.                 "name":"stackoverflow.com",
  14.                 "messages":["msg 1","msg 2","msg 3"]
  15. }
  16. [root@localhost tmp]#
  17.  
  18. ===
  19.  
  20. [root@localhost tmp]# bash -x 52399819.sh
  21. ++ getserver
  22. ++ curl -X GET http://localhost:8000/json52399819.json
  23.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  24.                                  Dload  Upload   Total   Spent    Left  Speed
  25. 100    86  100    86    0     0  12404      0 --:--:-- --:--:-- --:--:-- 14333
  26. + servers='{
  27.                "age":100,
  28.                "name":"stackoverflow.com",
  29.                "messages":["msg 1","msg 2","msg 3"]
  30. }'
  31. + echo '{' '"age":100,' '"name":"stackoverflow.com",' '"messages":["msg' '1","msg' '2","msg' '3"]' '}'
  32. + jq .
  33. {
  34.   "age": 100,
  35.   "name": "stackoverflow.com",
  36.   "messages": [
  37.     "msg 1",
  38.     "msg 2",
  39.     "msg 3"
  40.   ]
  41. }
Add Comment
Please, Sign In to add comment