当前位置:网站首页>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

边栏推荐
- Introduction to PHP MySQL
- 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
- Torch learning notes (3) -- univariate linear regression model (self training)
- Computer graduation design PHP campus address book telephone number inquiry system
- 【统信UOS】扫描仪设备管理驱动安装
- Torch learning notes (5) -- autograd
- The vscode code is automatically modified to a compliance code when it is formatted and saved
- Image 24 bit depth to 8 bit depth
- Have you learned the correct expression posture of programmers on Valentine's day?
- Image 24 bits de profondeur à 8 bits de profondeur
猜你喜欢

Codeforces Round #803 (Div. 2) C. 3SUM Closure

Computer graduation design PHP sports goods online sales system website
![Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]](/img/da/0a282b4773fe3909d1e5e9d19f8549.jpg)
Lesson 13 of the Blue Bridge Cup -- tree array and line segment tree [exercise]

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

win32:堆破壞的dump文件分析

Codeforces Round #803 (Div. 2) C. 3SUM Closure

Theoretical description of linear equations and summary of methods for solving linear equations by eigen

Raft log replication

4. Load balancing and dynamic static separation

How to track the real-time trend of Bank of London
随机推荐
Xception for deeplab v3+ (including super detailed code comments and original drawing of the paper)
win32:堆破壞的dump文件分析
2022-2028 global petroleum pipe joint industry research and trend analysis report
Bloom filter [proposed by bloom in 1970; redis cache penetration solution]
Administrative division code acquisition
CV in transformer learning notes (continuously updated)
Raft 日志复制
[tutorial] build your first application on coreos
[combinatorics] generating function (generating function application scenario | using generating function to solve recursive equation)
AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]
[untitled]
[LINUX]CentOS 7 安装MYSQL时报错“No package mysql-server available“No package zabbix-server-mysql availabl
2022-2028 global plasmid DNA cdmo industry research and trend analysis report
Image 24 bit depth to 8 bit depth
Use of unsafe class
What is SQL get connection
【统信UOS】扫描仪设备管理驱动安装
G1 garbage collector of garbage collector
204. Count prime
Grammaire anglaise Nom - Classification