当前位置:网站首页>Use of shell scripts & and 𞓜
Use of shell scripts & and 𞓜
2022-04-23 06:48:00 【tilblackout】

- If the previous instruction is executed correctly , stay Linux One will be sent back in the $?=0 Value
example 1: Judge whether the file exists , Create another file if it exists
ls /tmp/abc && touch /tmp/abc/hehe
example 2: Judge whether the file exists , There is no creation , Being doesn't do anything
ls /tmp/abc || touch /tmp/abc
example 3: Judge whether the file exists , There is a display "exist", There is no display "not exist"
# When there are multiple instructions, execute them in sequence , The latter one is based on the former one $? perform
ls /tmp/vbirding && echo "exist" || echo "not exist"
# No display ls Output result
ls 1.txt >/dev/null 2>&1 && echo "exist" || echo "not exist"
版权声明
本文为[tilblackout]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230549282568.html
边栏推荐
- Camera calibration: key point method vs direct method
- Collection of practical tips for C language (continuously updated)
- [UDS unified diagnostic service] II. Network layer protocol (1) - overview and functions of network layer
- C语言进阶要点笔记5
- 修改注册表的值
- Matlab calibration board corner detection principle
- C语言 #和##的使用
- VHDL arbitrary frequency divider (50% duty cycle)
- [UDS unified diagnostic service] IV. typical diagnostic service (2) - data transmission function unit
- Using printf in MFC
猜你喜欢
随机推荐
2020 Jiangsu Collegiate Programming Contest-A.Array
Understanding of SSH public key and private key
Analysis and setting of dead time
[opencv] use filestorage to read and write eigenvectors
Sdoi2009-hh Necklace
Quaternion multiplication
Interprocess communication - mutex
C语言进阶要点笔记4
undefined reference to `Nabo::NearestNeighbourSearch
Error in created hook: “ReferenceError: “Promise”未定义“
Introduction to nonparametric camera distortion model
cv_bridge 与opencv 版本不匹配的解决
ROS包nmea_navsat_driver读取GPS、北斗定位信息笔记
Krypton binary
Special register C51 / C52
监听除某元素之外点击事件
Vs can be compiled, but there will be a red underline to indicate the problem of undefined identifiers
逻辑回归原理及代码实现
Multibyte and Unicode in VS
Running QT program in visual Stdio








