当前位置:网站首页>shell指令学习1
shell指令学习1
2022-04-23 05:30:00 【mg1507】
1、 shell的作用
- 自动化批量系统初始化程序(update,软件安装,时区设置,安全策略…);
- 自动化批量软件部署程序;(LAMP/LNMP/Tomcat/LVS/Nginx);
- 管理应用程序(KVM、集群管理扩容、MySQL);
- 日志分析处理程序(PV、UV、200、!200、grep/awk);
- 自动化备份恢复程序(MySQL完全备份/增量+Crond)…
2、echo $?
输出返回值,如果正确则是0,非0代表错误。
3、命令1 && 命令2 &&具备逻辑判断,当命令1执行成功则执行命令2。
4、命令1 || 命令2 当命令1执行失败,则命令2执行。
5、&>
重定向混合输出,包括标准输出和错误输出。
# 将无用的信息输出到/dev/null
&> /dev/null
6、sh脚本,bash xxx.sh执行 sh xxx.sh也可以执行。
7、如果通过路径来执行,需要加权限 chmod +x xxx.sh。
8、shell脚本开头一般写上:#!/usr/bin/bash
其作用是:定义程序用哪个解释器执行。
9、合并两个文件 cat xx1 >> xx2
,>
将正常信息重定向,重定向是覆盖原始的文件,>>
则是追加。
10、&
表示任务在后台执行。
版权声明
本文为[mg1507]所创,转载请带上原文链接,感谢
https://blog.csdn.net/mg1507/article/details/111222593
边栏推荐
- egg中的cors和proxy(づ ̄3 ̄)づ╭~踩坑填坑的过程~ToT~
- Double click The jar package cannot run the solution
- Write the declaration of a function to return the reference of the array, and the array contains 10 string objects (notes)
- Interpretation of common SQL statements
- (11) Vscode code formatting configuration
- C, class library
- Box collapse and margin collapse
- Laravel routing job
- World and personal development
- Usage and difference of shellexecute, shellexecuteex and winexec in QT
猜你喜欢
随机推荐
[untitled]
Necessity of selenium preloading cookies
What financial products will benefit during May Day?
Multi process model in egg -- egg document Porter
跨域CORS的情缘~
Arithmetic and logical operations
Add two pointers? (legal or illegal)
STD:: String implements split
Uniapp hot update with progress bar
varnish入门
Phlli in a VM node
[untitled] Notepad content writing area
Excel 2016 打开文件第一次打不开,有时空白,有时很慢要打开第二次才行
The QT debug version runs normally and the release version runs crash
Basic knowledge of redis
Membarrier (personal learning and understanding)
Simple and basic use of switch and if
Edit, cancel, pull up menu
IPI interrupt
Three of three JS (webgl) is simple to draw lines / arcs according to points (based on linegeometry / line2 / linematerial, draw two arc segments based on the center of the circle)