当前位置:网站首页>4、 Variable assignment method
4、 Variable assignment method
2022-06-24 01:40:00 【jackxiao】
- Definition a=1
- Parameter transfer
- cat test7.sh
#!/bin/bash a=$1 b=$2 echo "a-b=$(($a-$b))" echo "a+b=$(($a+$b))" echo "a*b=$(($a*$b))" echo "a/b=$(($a/$b))" echo "a**b=$(($a**$b))" echo "a%b=$(($a%$b))"
- read Read in -p Tips -t Waiting time for user input
read -t 30 -p " Please enter a number :" a
Please enter a number :11
Two 、read Enterprise case
Judge what you input , And carry out corresponding operations according to the entered serial number , The script is as follows
- cat select1.sh
#!/bin/bash
cat <<EOF
1.install lamp
2.install lnmp
3.exit
EOF
read -p " Please select a sequence number ( It has to be numbers ):" num
#1. Judge whether it is an integer
expr 2 + $num &>/dev/null
if [ $? -ne 0 ]
then
echo "Usage:$0 {1|2|3}"
exit 1
fi
#2. Judgment execution processing
if [ $num -eq 1 ]
then
echo "install lamp..."
elif [ $num -eq 2 ]
then
echo "install lnmp..."
elif [ $num -eq 3 ]
then
echo "bye."
exit
else
echo "Usage:$0 {1|2|3}"
exit 1
fi边栏推荐
- Build a smart drug supervision platform based on easycvr video technology and build a drug safety firewall
- Disaster recovery series (VI) -- data storage disaster recovery construction
- What is pension finance? What are the pension financial products?
- Code practice | ground extraction with logo-loam
- How to write the domain name of trademark registration? What is the process of trademark and domain name registration?
- "Cross border" layout photovoltaic circle Green Island wind invested 4.6 million to layout distributed photovoltaic power generation
- Flink weapon: introduction to the open source platform streamx
- An error is reported when easynvr uploads the SSL certificate: the network request fails. How to handle it?
- Easynvr background channel list timing request touchstreamclient interface optimization
- Software cost evaluation: basic knowledge interpretation of cosmoc method
猜你喜欢
![[flutter] comment utiliser les paquets et plug - ins flutter](/img/a6/e494dcdb2d3830b6d6c24d0ee05af2.png)
[flutter] comment utiliser les paquets et plug - ins flutter
![[SQL injection 12] user agent injection foundation and Practice (based on burpsuite tool and sqli labs LESS18 target machine platform)](/img/c8/f6c2a62b8ab8fa88bd2b3d8f35f592.jpg)
[SQL injection 12] user agent injection foundation and Practice (based on burpsuite tool and sqli labs LESS18 target machine platform)
![[SQL injection 13] referer injection foundation and Practice (based on burpseuite tool and sqli labs less19 target platform)](/img/b5/a8c4bbaf868dd20b7dc9449d2a4378.jpg)
[SQL injection 13] referer injection foundation and Practice (based on burpseuite tool and sqli labs less19 target platform)

I, a 27 year old female programmer, feel that life is meaningless, not counting the accumulation fund deposit of 430000

【Flutter】如何使用Flutter包和插件

It's too difficult for me. Ali has had 7 rounds of interviews (5 years of experience and won the offer of P7 post)
随机推荐
PVE enables the hardware graphics card pass through function
Collation of commonly used glusterfs commands
Troubleshooting and repair of easygbs docking with universal video equipment to broadcast message 487
Implementation of automatic triggering of inward delivery order after outward delivery order PGI in SAP inter company sto process
[technical grass planting] the cloud driver takes you straight to the clouds
The dispute between traditional IT development and low code development is heated, and the technical development rules may be restructured?
"Ai+ education" and "Ai education": one for education and the other for Education
Introduction to easycvr interfacing with Huawei IVS subscription camera and user change request interface
5-step method to quickly find data analysis ideas
Eight common errors in programming
Code practice | ground extraction with logo-loam
Note sharing (5) -precautions for Oracle to MySQL
Introduction to trusted service manager
How to use IOT gateway to realize networking communication of smart road lamp posts
Moment. JS how to use epoch time to construct objects
How does Huawei weautomate RPA achieve the natural growth of government enterprise automation?
Blog platform was falsely blackmailed and the new hacker organization claimed responsibility for the Israeli attack | November 16 global network security hotspot
Use Navicat software to connect self built database (Linux system)
How do small businesses do a good job in website construction? Is there any guarantee for network companies to build websites
PHP implementation of interval sorting of classified data