In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Before we begin, take a look at the logical judgment symbols: & & and, | or! Non-A & & B must be established at the same time in order to pass the judgment-> judgment process: first execute A to determine whether it is established, and if it is established, continue to execute B to determine whether it is established-- > if it is not established, then directly end, no longer execute BA | | BA, B has an establishment, you can pass the judgment! An if An is not true, then by judging the number and symbol, as follows: comparison value: equal to-- >-- eq does not equal->-ne less than-- >-- lt greater than-- >-- gt less than or equal->-- le greater than or equal to->-ge some English words: help to remember some English words: equal equal to, not equal not equal, less than less than, great than greater than less equal less than or equal to great equal.
Comparison string: = equal, = equal, same =,! = not equal, > greater than, the application source code is as follows: [root@linux4 ~] # if [- d / root]; then / / to determine whether the root directory exists
> echo "ok" / / if there is an input OK
> fi
Ok## practical 2:if dual Branch Application-> pinghost.sh
Ping-c 3-I 0.2-w 3 192.168.1.1 the number of packets sent by Murc-I the interval between each packet sent. The default unit: second (s)-w waiting time. The source code that exceeds the return failure is as follows: #! / bin/bash# ping a given host and print the host status
Ip=192.168.1.1
Ping-c 3-I 0.2-w 3$ ip > > / dev/null #-c count-I?-w wait?
If [$?-eq 0]; then?
Echo "the host $ip is up."?
Else
Echo "the host $ip is down."?
Fi## actual combat 3:if multi-branch application-> judge numerical interval num.sh
The source code is as follows: #! / bin/bashread-p "Please enter a score:" numif [$num-gt 85-a $num-lt 100]; then
Echo 'excellent!'
Elif [$num-gt 70]; then
Echo 'good!'
Elif [$num-gt 60]; then
Echo 'qualified!'
Else
Echo 'not qualified!'
Fi
# # practical 4:if nesting use
The source code is as follows: #! / bin/bash
Read-p "Please enter the student's grade:" a
If [$a-lt 10]; then
Echo "Congratulations to this student on reaching the finals!"
Read-p "Please enter the classmate's gender:" b
If [$b = "male"]; then
Echo "Congratulations to this student on entering the men's final group!"
Else
Echo "Congratulations to this student on entering the women's final group!"
Fi
Fi
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.