当前位置:网站首页>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
边栏推荐
- 199. Right view of binary tree - breadth search
- [combinatorics] exponential generating function (properties of exponential generating function | exponential generating function solving multiple set arrangement)
- What kind of experience is it when the Institute earns 20000 yuan a month?
- Reappearance of ASPP (atlas spatial pyramid pooling) code
- Introduction to PHP MySQL
- CV in transformer learning notes (continuously updated)
- English语法_形容词/副词3级 - 倍数表达
- PHP MySQL preprocessing statement
- Torch learning notes (4) -- torch's dynamic calculation diagram
- 2022-2028 global sepsis treatment drug industry research and trend analysis report
猜你喜欢
Module 9 operation
多媒体NFT聚合平台OKALEIDO即将上线,全新的NFT时代或将来临
Three gradient descent methods and code implementation
How many convolution methods does deep learning have? (including drawings)
2022-2028 global solid phase extraction column industry research and trend analysis report
Raft 日志复制
论文阅读 GloDyNE Global Topology Preserving Dynamic Network Embedding
Why can deeplab v3+ be a God? (the explanation of the paper includes super detailed notes + Chinese English comparison + pictures)
Theoretical description of linear equations and summary of methods for solving linear equations by eigen
2022-2028 global lithium battery copper foil industry research and trend analysis report
随机推荐
Distributed task distribution framework gearman
Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time
2022-2028 global petroleum pipe joint industry research and trend analysis report
On Data Mining
Coordinate layer conversion tool (video)
网格图中递增路径的数目[dfs逆向路径+记忆dfs]
PHP MySQL Update
[combinatorics] generating function (use generating function to solve the number of solutions of indefinite equation example 2 | extended to integer solution)
[combinatorics] generating function (positive integer splitting | repeated ordered splitting | non repeated ordered splitting | proof of the number of repeated ordered splitting schemes)
The number of incremental paths in the grid graph [dfs reverse path + memory dfs]
Codeforces Round #803 (Div. 2) C. 3SUM Closure
G1 garbage collector of garbage collector
Administrative division code acquisition
Redis core technology and practice - learning notes (11): why not just string
Win 11 major updates, new features love love.
The vscode code is automatically modified to a compliance code when it is formatted and saved
English语法_名词 - 分类
Enterprise custom form engine solution (12) -- form rule engine 2
Gao Qing, Beijing University of Aeronautics and Astronautics: CIM is a natural quantum computing platform for graph data processing
[combinatorics] generating function (example of using generating function to solve the number of solutions of indefinite equation)