当前位置:网站首页>Shell script
Shell script
2022-06-24 21:06:00 【AcTarjan】
Variable
NAME=$ID # Will parse variables ID
NAME=AcTarjan #$NAME=AcTarjan
NAME=hello world # Will make mistakes , No spaces
NAME="$ID world" # Variables are parsed
NAME="hello world" # Spaces are allowed
NAME='$ID world' # Variables will not be resolved ,$ID Original output
NAME=`pwd` # The variable is equal to the result of the command execution output
Regular expressions
Common operations
- Determine whether the directory exists
if [ ! -d $INSTALL_DIR ]; then
echo "$INSTALL_DIR doesn't exist"
exit
fi
- Judge whether the file exists
if [ -f "/data/filename" ];then
echo " File exists "
else
echo " file does not exist "
fi
- string matching
# regular expression
if [[ $FILENAME =~ ^test.*zip$ ]];then
echo "matched $FILENAME"
else
echo "mismatched $FILENAME"
fi
- Traverse the directory
for file in `ls`
do
echo $file
done
边栏推荐
- Memo mode - game archiving
- Mr. Hu Bo, CIO of weiduomei, a scientific innovator: digitalization is a bloodless revolution, and the correct answer lies in the field of business
- Basic concepts and definitions of Graphs
- 在Dialog中使用透明的【X】叉叉按钮图片
- Wechat applet custom tabbar
- What will you do if you have been ignored by your leaders at work?
- The Google File System (GFS) learning notes
- Packaging_ Conversion between basic type and string type
- 等保备案是等保测评吗?两者是什么关系?
- Steps of JMeter performance test
猜你喜欢

Visitor model -- generation gap between young and middle-aged people

"Ningwang" was sold and bought at the same time, and Hillhouse capital has cashed in billions by "selling high and absorbing low"

How to apply agile development ideas to other work
Talking about the range of data that MySQL update will lock

maptalks:数据归一化处理与分层设色图层加载

Vant component used in wechat applet

在Dialog中使用透明的【X】叉叉按钮图片

网络安全审查办公室对知网启动网络安全审查

Common data model (updating)

微信小程序自定义tabBar
随机推荐
Mr. Hu Bo, CIO of weiduomei, a scientific innovator: digitalization is a bloodless revolution, and the correct answer lies in the field of business
Power apps Guide
C語言實現掃雷(簡易版)
How to apply agile development ideas to other work
Simulation lottery and probability statistics experiment of the top 16 Champions League
顺序栈遍历二叉树
Interpreter mode -- formulas for dating
DX12引擎开发课程进度-这个课程到底讲到哪里了
大一女生废话编程爆火!懂不懂编程的看完都拴Q了
主数据建设的背景
"Ningwang" was sold and bought at the same time, and Hillhouse capital has cashed in billions by "selling high and absorbing low"
Analysis of errors in JSON conversion using objectmapper
NPM download speed is slow
JMeter parameterization
Static routing job
Wechat applet custom tabbar
The Google File System (GFS) learning notes
云计算发展的 4 个阶段,终于有人讲明白了
Apple, Microsoft and Google will no longer fight each other. They will work together to do a big thing this year
DAPP system customization of full chain hash game (scheme design)