当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
统计字符串中每个字符出现的次数
Opencv uses genericindex for KNN search
TensorFlow张量介绍
VHDL arbitrary frequency divider (50% duty cycle)
[UDS unified diagnostic service] IV. typical diagnostic service (2) - data transmission function unit
Palindromic Primes
SQLite3 encrypted version
[stepping on the pit] MELD in win11 wsl2 cannot be used normally. Problem repair
Qt 给应用程序加图标
Error in created hook: “ReferenceError: “Promise”未定义“
ES6
深蓝学院激光slam 理论与实践 第三章激光雷达去畸变 作业习题
C语言 #和##的使用
The use of volatile in C language
Krypton zeal
The difference between single quotation mark, double quotation mark and back quotation mark in shell script
基于VGG卷积神经网络的图像识别代码实现
CUDA environment installation
修改注册表的值
Assembler 32-bit unsigned addition calculator