当前位置:网站首页>Basic shell operations (Part 2)
Basic shell operations (Part 2)
2022-07-29 08:24:00 【Crying dogs in the sun】
Catalog
Operator
Arithmetic operator
- expr + , - , *, /, % Add , reduce , ride , except , Remainder

Compound operation , Be careful `` Not single quotes
- “ ( ( shipment count type ) ) ” or “ (( Arithmetic expression ))” or “ (( shipment count type ))” or “[ Arithmetic expression ]”

String operators
- = Checks if two strings are equal , Relative return true
- != Detect whether two strings are not equal , Unequal return true
- -z Check if the string length is 0, by 0 return true
- -n Check whether the string length is not 0, Not for 0 return true
- $ Check if the string is empty , Not empty return true
In the process control meeting
Process control
if else Judge
grammar :
if [ Conditional judgment ]
then
command
fi
===============================
if [ Conditional judgment ]
then
command
else
command
fi
==============================
if [ Conditional judgment ]
then
command
elif [ Conditional judgment ]
then
command
else
command
fi
Be careful Space , stay if And after [] Spaces should be added in 
You can also write it as a sentence and add ; Such as if [ a=b ];then echoxxxxxxx;xxx;xxx;
case sentence
Every case The branch begins with a right parenthesis , Use two semicolons ;; Express break, End with esac Express
case $ Variable name in
" value 1")
If the value of the variable is equal to the value 1, Then execute the procedure 1
;;
" value 2")
If the value of the variable is equal to the value 2, Then execute the procedure 2
;;
… Omit other branches …
*)
If none of the values of the variables are above , Then execute this procedure
;;
esac


for loop
And in other languages for The cycle is similar
for Variable in item1 item2 ... itemN
do
command
.....
done
==========================
for (( expression ))
do
command
.....
done

while loop
while [ Conditional judgment ]
do
command
done
====================
while (( expression ))
do
command
done

function
Function name (){
The body of the function
[return]
}
No addition return Will return the last sentence 
边栏推荐
- Importerror: no module named XX
- Dp4301-sub-1g highly integrated wireless transceiver chip
- [robomaster] control RM motor from scratch (2) -can communication principle and electric regulation communication protocol
- (Video + graphic) machine learning introduction series - Chapter 5 machine learning practice
- Product promotion channels and strategies, cosmetics brand promotion methods and steps
- New energy shared charging pile management and operation platform
- Charging pile charging technology new energy charging pile development
- Background management system platform of new energy charging pile
- Hal learning notes - Advanced timer of 7 timer
- The first week of postgraduate freshman training: deep learning and pytorch Foundation
猜你喜欢

MySQL中的时间函数

Simplefoc+platformio stepping on the path of the pit

Simplefoc parameter adjustment 3-pid parameter setting strategy

Cluster usage specification

Tle5012b+stm32f103c8t6 (bluepill) reading angle data

Reading of false news detection papers (3): semi supervised content-based detection of misinformation via tensor embeddings

Unicode private use areas

Background management system platform of new energy charging pile

Hal learning notes - Advanced timer of 7 timer

Eps32+platform+arduino running lantern
随机推荐
Ws2812b color lamp driver based on f407zgt6
pnpm install出现:ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies
Inclination monitoring solution of Internet of things
MySQL中的时间函数
Proteus simulation based on msp430f2491
Intelligent temperature control system
Cs5340 domestic alternative dp5340 multi bit audio a/d converter
Day4: the establishment of MySQL database and its simplicity and practicality
DC motor control system based on DAC0832
PostgreSQL manually creates hikaridatasource to solve the error cannot commit when autocommit is enabled
ML.NET相关资源整理
Gan: generate adversarial networks
A problem encountered in SQL interview
Day5: PHP simple syntax and usage
[robomaster] control RM motor from scratch (2) -can communication principle and electric regulation communication protocol
随机抽奖转盘微信小程序项目源码
STM32 printf problem summary semihosting microlib understanding
Security baseline of network security
Deep learning (2): image and character recognition
Markdown concise grammar manual