当前位置:网站首页>Shell script return value with which output
Shell script return value with which output
2022-07-03 18:34:00 【-Abu-】

I want to return to one false that will do , The result is a node Path out , The script is as follows :
#!/bin/bash
# Tips “ Please enter a name ” And wait for 30 second , Save user input into variables name in
read -t 30 -p " Please enter your mobile number :" phone
# Tips “ Please input a password ” And wait for 30 second , Save user input into variables pwd in , Input content is hidden
read -t 30 -s -p " Please enter the user password :" password
echo -e "\n"
# Login interface
loginRes=`curl -X POST "'Content-type':'application/json'" -d '{"api":"login.pw","params":{"loginId":'$phone',"password":'$password',"appId":"yptb"},"nonce":"uuid","sign":"sign","version":"1.0","timestamp":"230993499430010"}' https://apigw.xxxx.com/request`
echo " Login return information :$loginRes"
function getJsonValueByNode() {
if which node; then
local json="$1"
local key="$2"
node -pe "JSON.stringify(JSON.parse(process.argv[1]).$key)" "$json" | awk '{print ($0 == "undefined" ? "null" : $0)}'
return 0
else
return 1
fi
}
value=$(getJsonValueByNode $loginRes "result.success")
echo " Variable :$value"Solution :
take which Of output to /dev/null in , Reference resources :How can I check if a program exists from a Bash script? - Stack Overflow

边栏推荐
- [combinatorics] generating function (example of generating function | calculating generating function with given general term formula | calculating general term formula with given generating function)
- 2022-2028 global scar care product industry research and trend analysis report
- The number of incremental paths in the grid graph [dfs reverse path + memory dfs]
- [untitled]
- PHP MySQL inserts data
- Administrative division code acquisition
- How to analyze the rising and falling rules of London gold trend chart
- Solve the problem of inaccurate network traffic monitored by ZABBIX with SNMP
- Change the single node of Postgres database into master-slave
- Sepconv (separable revolution) code recurrence
猜你喜欢

Naoqi robot summary 27

Redis core technology and practice - learning notes (IX): slicing cluster

Grammaire anglaise Nom - Classification

2022-2028 global physiotherapy clinic industry research and trend analysis report

Mysql45 lecture learning notes (II)
![[untitled]](/img/83/5a57ed90aaafde94db600246256867.jpg)
[untitled]

Real time split network (continuous update)
![[enumeration] annoying frogs always step on my rice fields: (who is the most hateful? (POJ hundred practice 2812)](/img/50/f89092b492d0138304209a72ff05b4.jpg)
[enumeration] annoying frogs always step on my rice fields: (who is the most hateful? (POJ hundred practice 2812)

Redis on local access server

Should I be laid off at the age of 40? IBM is suspected of age discrimination, calling its old employees "dinosaurs" and planning to dismiss, but the employees can't refute it
随机推荐
Raft 日志复制
Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]
This diversion
PHP MySQL inserts multiple pieces of data
[combinatorics] generating function (commutative property | derivative property | integral property)
[combinatorics] generating function (use generating function to solve the number of solutions of indefinite equation)
Computer graduation project PHP library book borrowing management system
PHP MySQL inserts data
Introduction to PHP MySQL
Real time split network (continuous update)
SQL injection -day16
Bidding procurement scheme management of Oracle project management system
Unsafe类的使用
win32:堆破坏的dump文件分析
2022-2028 global scar care product industry research and trend analysis report
[combinatorics] generating function (use generating function to solve the number of solutions of indefinite equation example 2 | extended to integer solution)
Mature port AI ceaspectus leads the world in the application of AI in terminals, CIMC Feitong advanced products go global, smart terminals, intelligent ports, intelligent terminals
Redis core technology and practice - learning notes (VI) how to achieve data consistency between master and slave Libraries
Setinterval CPU intensive- Is setInterval CPU intensive?
[combinatorics] exponential generating function (example of exponential generating function solving multiple set arrangement)