当前位置:网站首页>Methods of creating and modifying shell script files in batch
Methods of creating and modifying shell script files in batch
2022-06-24 04:05:00 【User 8989785】
One 、 Script requirements
1. All operations are in /python Next
2. Batch creation 12 In a py The file at the end of the suffix , The file name must contain _hcip, File name except _hcip Fixed string , The file name also contains 8 Random lowercase characters .
3. Created 12 File suffixes are changed to uppercase PY, The fixed string is changed to _hcie
Two 、 The script content
#!/bin/bash
##########################################################
#File Name:create_file.sh
#Version:V1.0
#Aurhor:
#Emali:
#Created Time:2021-06-15 02:56:59
#Description: create files & modify files
##########################################################
if [ -d /python ];then
cd /python
else
mkdir /python
cd /python
fi
for i in {1..12}
do
file_name=$(echo $RANDOM |md5sum |cut -c 1-8)
touch ${file_name}_hcip.py
done
for files in $(ls /python)
do
file1=$(echo $files |cut -d '_' -f1)
mv $files ${file1}_hcie.PY
done3、 ... and 、 Script run result
[[email protected] python]# /scripts/create_file.sh [[email protected] python]# ll total 0 -rw-r--r-- 1 root root 0 Jun 15 04:26 4272db00_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 51989a58_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 75075364_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 7a272319_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 7d76af2f_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 977e73d6_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 9e4386a0_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 a35d5337_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 b9cb6458_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 b9d3349e_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 c3e589a2_hcie.PY -rw-r--r-- 1 root root 0 Jun 15 04:26 e4f82be8_hcie.PY
summary
This is about Shell This is the end of the article on batch creation and modification of script files .
边栏推荐
- The quick login of QQ cannot be directly invoked through remote login, and the automatic login of QQ can be invoked using VNC
- Clickhouse synchronous asynchronous executor
- 开源之夏2022中选结果公示,449名高校生将投入开源项目贡献
- High quality travel on national day, visual start of smart Tourism
- How to adjust the incompleteness before and after TS slicing of easydss video recording?
- Diskpart San policy is not onlineall, which affects automatic disk hanging
- Received status code 502 from server: Bad Gateway
- Browser rendering mechanism
- How to select a telemedicine program system? These four points are the key!
- After 20 years of development, is im still standing still?
猜你喜欢

黑帽SEO实战之通用301权重pr劫持

黑帽实战SEO之永不被发现的劫持

Halcon knowledge: contour operator on region (2)

Modstartcms theme introductory development tutorial

Clickhouse (02) Clickhouse architecture design introduction overview and Clickhouse data slicing design

openEuler Kernel 技术分享第 20 期 | 执行实体创建与切换

On game safety (I)

openEuler社区理事长江大勇:共推欧拉开源新模式 共建开源新体系

Pine Script脚本常用内容

618 promotion: mobile phone brand "immortal fight", high-end market "who dominates the ups and downs"?
随机推荐
RPM 包的构建 - SPEC 基础知识
Pine Script脚本常用内容
High quality travel on national day, visual start of smart Tourism
给你讲懂 MVCC
[hot promotion] Tencent cloud enterprise cloud disk solution
ModStartCMS 企业内容建站系统(支持 Laravel9)v4.2.0
Do you understand TLS protocol?
An open source monitoring data collector that can monitor everything
Web penetration test - 5. Brute force cracking vulnerability - (4) telnet password cracking
openGauss 3.0版本源码编译安装指南
[Numpy] Numpy对于NaN值的判断
C language linked list points to the next structure pointer, structure and its many small details
How to adjust the incompleteness before and after TS slicing of easydss video recording?
The use of char[0] and char[1] in C language structure
openEuler Kernel 技术分享第 20 期 | 执行实体创建与切换
Spirit breath development log (17)
hprofStringCache
ModStartCMS 主题入门开发教程
C language in DSP (2) -- definition of structure
Modstartcms theme introductory development tutorial