shell 智能机器人

来源:互联网 发布:apache安装 编辑:程序博客网 时间:2024/05/01 22:36
#!/bin/bash#read -p "请输入您想和小young说的话:" input#curl -G -d "key=abda91b36e4943daa38ed8af41eae833&info=$input" http://www.tuling123.com/openapi/api |cut -d ":" -f3|cut -d '"' -f2# {"code":100000,"text":"嘿嘿,你脸红了啊"}  cat 1 |cut -d ":" -f3|cut -d '"' -f2while [[ true ]]; doread -p "请输入您想和小young说的话:" inputcurl -G -d "key=这里输入您申请的KEY&info=$input" -s http://www.tuling123.com/openapi/api |cut -d ":" -f3|cut -d '"' -f2done



附上截图;



那是之前的版本 现在附上改进后的版本,


#!/bin/bash#read -p "请输入您想和小young说的话:" input#curl -G -d "key=abda91b36e4943daa38ed8af41eae833&info=$input" http://www.tuling123.com/openapi/api |cut -d ":" -f3|cut -d '"' -f2# {"code":100000,"text":"嘿嘿,你脸红了啊"}  cat 1 |cut -d ":" -f3|cut -d '"' -f2#jq 是一个截取json的命令   wget http://stedolan.github.io/jq/download/linux64/jqexport LANG=zh_CN.UTF-8while [[ true ]]; doread -p "请输入您想和小young说的话:" icurl -H "Content-Type: application/json" -X POST -d '{"key":"abda91b36e4943daa38ed8af41eae833","info":"'"${i}"'"}' -s http://www.tuling123.com/openapi/api |jq '.'|grep -v -E "{|}"done


0 0
原创粉丝点击