当前位置:网站首页>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] exponential generating function (concept of exponential generating function | permutation number exponential generating function = combinatorial number ordinary generating function | e
- Codeforces Round #803 (Div. 2) C. 3SUM Closure
- 2022-2028 global copper foil (thickness 12 μ M) industry research and trend analysis report
- 圖像24比特深度轉8比特深度
- Xception for deeplab v3+ (including super detailed code comments and original drawing of the paper)
- The vscode code is automatically modified to a compliance code when it is formatted and saved
- Kratos微服务框架下实现CQRS架构模式
- Theoretical description of linear equations and summary of methods for solving linear equations by eigen
- Use of unsafe class
- CV in transformer learning notes (continuously updated)
猜你喜欢

English语法_形容词/副词3级 - 倍数表达

Bidding procurement scheme management of Oracle project management system
![AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]](/img/3d/6d61fefc62063596221f98999a863b.png)
AcWing 271. Teacher Yang's photographic arrangement [multidimensional DP]

English语法_名词 - 分类

How to track the real-time trend of Bank of London

Raft log replication

Data analysis is popular on the Internet, and the full version of "Introduction to data science" is free to download

NFT新的契机,多媒体NFT聚合平台OKALEIDO即将上线

2022-2028 global scar care product industry research and trend analysis report

2022-2028 global lithium battery copper foil industry research and trend analysis report
随机推荐
Redis core technology and practice - learning notes (IX): slicing cluster
Prototype inheritance..
Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time
Gao Qing, Beijing University of Aeronautics and Astronautics: CIM is a natural quantum computing platform for graph data processing
189. Rotation array
Bidding procurement scheme management of Oracle project management system
Win32: dump file analysis of heap corruption
WebView module manages the application window interface to realize the logical control and management operation of multiple windows (Part 1)
12、 Service management
PHP MySQL create database
Torch learning notes (1) -- 19 common ways to create tensor
After the festival, a large number of people change careers. Is it still time to be 30? Listen to the experience of the past people
Computer graduation project PHP library book borrowing management system
企业级自定义表单引擎解决方案(十二)--表单规则引擎2
What London Silver Trading software supports multiple languages
[combinatorics] generating function (positive integer splitting | unordered non repeated splitting example)
204. Count prime
win32:堆破壞的dump文件分析
Torch learning notes (5) -- autograd
Codeforces Round #803 (Div. 2) C. 3SUM Closure