Conditional judgment of Shell script
1. Basic grammar
[condition] (note that there should be spaces before and after the condition) Note: if the condition is not empty, it is true, [666] returns true and [] returns false.
2. Common judgment conditions
(1) Comparison between two integers = string comparison -lt less than -le less than or equal -eq equals (equal) -gt greater than ...
Posted by phpIsKillingMe on Sun, 05 Dec 2021 18:34:49 -0800
Big data learning tutorial SD version - Part 1 [shell]
1.shell
Shell command line interpreter, Linux scripting language
1.1 variables
Common system variables: $HOME $PWD $SHELL $USERStrict space rules
There must be no spaces on either side of the equal signThere are spaces in the variable. You can wrap it with "" or ()There must be a space between expr operatorsThere should b ...
Posted by bumbar on Wed, 01 Dec 2021 13:51:37 -0800
Detailed explanation of cross compilation (making cross compilation chain from zero)
Compiling environment
Host hardware environment:
$ uname -a
Linux PC 4.4.0-42-generic #62-Ubuntu SMP Fri Oct 7 23:11:45 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
12
Host software environment:
$ cat /etc/issue
Ubuntu 16.04.1 LTS
12
Tools to install:
sudo apt-get install libncurses5-dev
sudo apt-get ...
Posted by yandoo on Wed, 01 Dec 2021 03:41:52 -0800
Shell distribution script
Shell distribution script
principle
In the cluster, we often have this requirement: copy files to the same directory of all nodes in a circular way, and use commands separately from one node to another to improve efficiency.
Core idea
Encapsulation on rsync
rsync command analysis
characteristic
rsync remote synchronization tool
rsync is mainly ...
Posted by grantf on Sun, 21 Nov 2021 23:16:16 -0800
shell loop explanation and examples
1, Condition selection and judgment (if, case)
1.1 if statement usage and examples
When we need to judge in the script, we can use the if statement to implement it. The specific syntax is as follows:
Single branch
if judgment conditions; then
Branch code with true condition fi
Double branch
if ...
Posted by kumar_ldh on Wed, 10 Nov 2021 14:42:35 -0800
Explain several ways for Linux to view real-time network card traffic
If kept has 10 VIPs, how to check the traffic of each VIP?
Here you can use the sar command to view the network card traffic. The premise is that when you keep listening to the network card. Set the subinterface when setting up the network card.
That is, your network card is bound to the sub interface. In this way, eth0:0 and eth0:1 can see t ...
Posted by XenoPhage on Mon, 08 Nov 2021 11:01:58 -0800
Learn Bash debugging in 10 minutes
Shell is a program for the interaction between users and the operating system. It is often used to perform some automated or repetitive and cumbersome tasks. Now all Linux systems basically bring this program. We only need to write shell scripts and execute them directly. There is no need to install additional software and configure the compi ...
Posted by bluwe on Tue, 02 Nov 2021 08:41:08 -0700
shell data filtering
Let's talk about data analysis:
Data collection: responsible for data collection
Data cleaning: responsible for data filtering
Data analysis: data operation and sorting
Data display: output results in chart or table mode
shell script data processing
1) Data retrieval: grep tr cut
2) Data processing: uniq sort tee paste xargs
In the previous s ...
Posted by Suchy on Fri, 29 Oct 2021 09:24:12 -0700
sed and awk of shell
catalogue
sed editor
sed common options
sed common operations:
Basic Usage
sed script format
Example:
Search for alternatives
Change configuration file
AWK
Basic usage
Get IP address
Common built-in variables in awk
sed editor
sed is a flow editor that edits the data flow based on pre pro ...
Posted by Tentious on Thu, 28 Oct 2021 06:10:13 -0700
Functions and arrays of Shell scripts
1, Functions
1.1 function
A statement block is defined as a function approximately equal to an alias, a function is defined, and then a function is referenced
Encapsulated reusable code with specific functions
1.2 basic format of function
Method I:
[function] Function name (){
Command sequence
[return x] #Use return or ...
Posted by Cannibal_Monkey on Wed, 27 Oct 2021 04:23:35 -0700