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

边栏推荐
- Graduation summary
- 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
- What London Silver Trading software supports multiple languages
- Opencv learning notes (continuously updated)
- Why can deeplab v3+ be a God? (the explanation of the paper includes super detailed notes + Chinese English comparison + pictures)
- 2022-2028 global copper foil (thickness 12 μ M) industry research and trend analysis report
- Administrative division code acquisition
- 圖像24比特深度轉8比特深度
- Use of unsafe class
- A. Berland Poker & 1000 [simple mathematical thinking]
猜你喜欢
![The number of incremental paths in the grid graph [dfs reverse path + memory dfs]](/img/57/ff494db248171253996dd6c9110715.png)
The number of incremental paths in the grid graph [dfs reverse path + memory dfs]

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

How do microservices aggregate API documents? This wave of operation is too good

English语法_名词 - 分类

What kind of experience is it when the Institute earns 20000 yuan a month?

MySQL duplicate check

CV in transformer learning notes (continuously updated)

Bidding procurement scheme management of Oracle project management system

Multifunctional web file manager filestash

Data analysis is popular on the Internet, and the full version of "Introduction to data science" is free to download
随机推荐
[combinatorics] generating function (example of generating function | calculating generating function with given general term formula | calculating general term formula with given generating function)
[enumeration] annoying frogs always step on my rice fields: (who is the most hateful? (POJ hundred practice 2812)
MySQL duplicate check
[combinatorics] exponential generating function (example of exponential generating function solving multiple set arrangement)
Valentine's day, send you a little red flower~
2022-2028 global sepsis treatment drug industry research and trend analysis report
[combinatorics] generating function (generating function application scenario | using generating function to solve recursive equation)
Data analysis is popular on the Internet, and the full version of "Introduction to data science" is free to download
[combinatorics] generating function (example of using generating function to solve the number of solutions of indefinite equation)
Redis core technology and practice - learning notes (VII) sentinel mechanism
Line by line explanation of yolox source code of anchor free series network (6) -- mixup data enhancement
Recent learning experience
Image 24 bits de profondeur à 8 bits de profondeur
PHP MySQL create database
虚拟机和开发板互Ping问题
Use of unsafe class
Torch learning notes (1) -- 19 common ways to create tensor
2022-2028 global solid phase extraction column industry research and trend analysis report
[untitled]
TypeScript 官网教程