当前位置:网站首页>ba_ Shell learning summary
ba_ Shell learning summary
2022-07-23 05:12:00 【IC fragmentary thoughts】
ba-shell Learning summary
Tags: script
shell What is it? ?
shell It's a command line interpreter , Provides users with a way to linux The kernel sends requests to run the program's interface system level program , User available shell To start up , Hang up , Stop even writing programs

shell classification :c_shell,z_shell,ba_shell
How the script is executed
- The script needs to #!/bin/bash start
- Scripts require executable permissions + X perhaps sh + xxx.sh perform .
Shell A variable is introduced
- Subsystem variables and user-defined variables ,
- System variables :$HOME $PWD $SHELL U S E R etc. etc. can use s e t display in the Yes Of system system change The amount “ USER wait You can use set Display all system variables “ USER etc. etc. can use set display in the Yes Of system system change The amount “” Used to represent variable substitution
- User customization : Variable name ( Do not start with a number , Capitalization )= value (= There must be no space between ) A=10
- Revoke variables :unset + Variable unset A
- Declare static variables :readonly Variable , Be careful : You can't unset
- take The return value of the command Assigned to a variable A=’date’ or A=$(date)
- take shell Variable output is environment variable / Global variables ( The whole picture is visible , Available variables ) export Variable name = value /etc/profile
- Let the modified profile take effect immediately source The configuration file source /etc/profile
- Multiline comment :<<! xxxx !
- Positional arguments $0 To express an order $1 Represents the first parameter ... 9 surface in The first 9 individual ginseng Count . 9 It means the first one 9 Parameters . 9 surface in The first 9 individual ginseng Count .# Indicates the number of parameters
- Operator writing REST1= ( ( 2 + 3 ) ) R E S T 2 = ((2+3)) REST2= ((2+3))REST2=[2+3] REST3= expr 2 + 3
grammar
conditional

1): = String comparison judgment statement :
2): A comparison of two integers
-lt Less than little-le Less than or equal to
-eq be equal to equal
-gt Greater than-ge Greater than or equal to
-ne It's not equal to
3): Judge according to the file authority
-r Have read permission
-w Have the right to write
-x Have the authority to execute4): Judge according to the document type
-f The file exists and is a regular file
-e File exists-d The file exists and is a directory
if [ "ok" = "ok" ] then echo "equal" fiif [ -f /root/shcode/aaa.txt ] then echo "exist" elif echo "not exist " ficase sentence

case $1 in # Positional arguments "1") echo " Monday “ ;; "2") echo " Tuesday " ;; *) echo "other..." ;; esac #case Write backFor loop


while loop

read Read console input

read -p " Please enter a num" NUM -t 10 echo " Input num=$NUM"Custom function


Learn to refer to teacher Han Shunping's video ( Attached video address )
https://www.bilibili.com/video/BV1Sv411r7vd?p=107&spm_id_from=pageDriver
边栏推荐
- 正则表达式常用的限定符&&Cookie
- 图像特征-sift(scale invariant feature transform)
- Modify oracle19c to monitor IP and restart under Linux centos7 environment
- 案例实战-全景图像拼接:特征匹配法
- Stanford cs231n course assignment - nearest neighbor classifier
- [deep learning] loss function (mean absolute error, mean square error, smoothing loss, cross entropy, cross entropy with weight, dice loss, focalloss)
- AXI協議詳解
- opencv 项目-信用卡识别(学习记录)
- Reverse order template
- 51nod 1616 minimum set (number theory)
猜你喜欢

BIST(build_in selftest)介绍

SVM To Face Recognize

*YOLO5学习*基于yolo5-face结合注意力模型SE的数据实验

ICM20948九轴传感器角速度读取与实际单位转化的换算关系

SV知识点总结

Jetpack chapter - lifecycle

The remote warehouse is pulled successfully, and the folder of the local warehouse still displays a red exclamation point

电信客户流失预测挑战赛baseline【AI比赛】

3步就能制作漫画头像的机器人,想拥有一个吗?

On GaN Network - II
随机推荐
Alexnet code implementation
handsontable 追加数据
Tampermonkey(油猴子)插件安装、使用
[deep learning] loss function (mean absolute error, mean square error, smoothing loss, cross entropy, cross entropy with weight, dice loss, focalloss)
工作空间创建
Connect to the server with vscode's remote SSH plug-in in the offline environment
Espressif esp-aws-iot 入门
周志华机器学习西瓜书第2章模型评估与选择——精度与模型泛化评估方法,自助法与集成学习
Espressif 8266 AT+MQTT连接AWS IoT
改正 RelFinder 画线方向错误的 bug
Yum usage record
Jupyter import Package Failed
AXI协议详解
图像特征-sift(scale invariant feature transform)
Druid源码阅读7-DruidDataSource的recycle过程
51nod 1616 minimum set (number theory)
makefile 使用简介
*After inputting the picture size, the number of channels changes and the printing of network structure and parameter quantity, which is suitable for querying your own network parameter size
yum 使用记录
51nod 2840 ATM (tarjan, shrink point, DFS)