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/03 Report--
1. What is shell?
A scripting language: is a collection of Linux system commands, written to the script file, execution; support logical judgment, loops and other structured statements; can customize functions, etc.
two。 The beginning of the script file #! / bin/bash
#! / bin/bash specifies which command interpreter to run under
3. The way the script runs
1) add x permission to the script file and run it directly
2) run through the sh command
4. Sh command
-n only check for syntax errors in shell statements, not shell commands
-x displays each command line and its results during shell execution of the script
5. Date command
Format: date [OPTION] [+ FORMAT]
-d displays the date and time referred to in the string
1) string format
% Y year
% m month
% d days
% H hours, 24-hour system (00-23)
% M minutes (00-59)
% s seconds
% D display date format (mm/dd/yy)
% F display date format (% Y-%m-%d)
% T display time (HH:MM:SS)
2)-d
Date-d "+ 1 day" displays the date of the following day
Date-d "- 1 day" shows the date of the previous day
Date-d "- 1 month" +% Y%m%d displays the date of the previous month, specifying the format
Date-d "+ 1 month" +% Y%m%d displays the date of the next month, specifying the format
3)% s timestamp
% s seconds experienced since 00:00:00 on January 1, 1970
6. Shell variable
1) when a string is used frequently in a script and the length of the string is very long, you should use variables instead of
2) when referencing the result of the command, replace it with a variable, such as n = `wc-l 1.txt`
3) variables are essential when writing scripts that interact with users.
Example: if the read command does not specify a variable, the default variable is REPLY
4) shell built-in variables
5) Mathematical operations, conditional statements, etc.
Axia1 bliss 2
Centering $(($astatb))
7. Logical judgment in shell
1) format 1
If condition; then statement; fi
2) format 2
If condition; then statement; else statement; fi
3) format 3
If condition; then statement; elif condition; then statement; else statement; 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.