当前位置:网站首页>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
边栏推荐
- Leetcode(455)——分发饼干
- 顺序表的基本操作
- 虚拟化是什么意思?包含哪些技术?与私有云有什么区别?
- How to apply agile development ideas to other work
- More than ten years' work experience is recommended at the bottom of the box: how much does it cost to find a job? See here! Brothers and sisters are recommended to collect and pay attention
- Where is 5g really powerful? What is the difference with 4G?
- 在Dialog中使用透明的【X】叉叉按钮图片
- How Fiddler works
- 云计算发展的 4 个阶段,终于有人讲明白了
- The JS method parameter passed a number beginning with 0. A magical problem occurred and bothered me for a long time
猜你喜欢

Adding subscribers to a list using mailchimp's API V3

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

Sleep revolution - find the right length of rest

Combination mode -- stock speculation has been cut into leeks? Come and try this investment strategy!

Agency mode -- Jiangnan leather shoes factory

After a few years in the testing industry, do you still know a little?

Does the developer want to change to software testing?

顺序表的基本操作

The JS method parameter passed a number beginning with 0. A magical problem occurred and bothered me for a long time

Basic operation of sequence table
随机推荐
Summary of idea practical skills: how to rename a project or module to completely solve all the problems you encounter that do not work. It is suggested that the five-star collection be your daughter
Create a multithreaded thread class
Popupwindow touch event transparent transmission scheme
Nifi quick installation (stand-alone / cluster)
The four stages of cloud computing development have finally been clarified
Freshman girls' nonsense programming is popular! Those who understand programming are tied with Q after reading
Basic operation of sequence table
A/b test helps the growth of game business
Grating diffraction
Enjoy yuan mode -- a large number of flying dragons
Open programmable infrastructure (OPI) project, redefining dpu/ipu
Design of routing service for multi Activity Architecture Design
图像PANR
Simpledateformat thread unsafe
Set up your own website (14)
Open function
Visitor model -- generation gap between young and middle-aged people
Learn together and make progress together. Welcome to exchange
Pyaudio audio recording
Steps of JMeter performance test