当前位置:网站首页>shell脚本文件遍历 str转数组 字符串拼接
shell脚本文件遍历 str转数组 字符串拼接
2022-07-05 11:00:00 【诸葛钢铁云】
#!/bin/bash
#file=$(cat /Users/jian.wang13/code/test/0701.txt)
#houzhui=$(awk -F '/' '{print $3}' /Users/jian.wang13/code/test/0701.txt)
houzhui=$(awk -F '/' '{print $3}' /root/snap/0701.txt)
#echo $houzhui,字符串拼接
qianzhui="XXXXX.com/"
for i in $houzhui
do
# echo $i
for j in $qianzhui
do
aws_jingxiang=$j$i
cn_jingxiang="XXXXX/"$i
echo $cn_jingxiang","$aws_jingxiang >> "/root/snap/jingxiang.txt"
if [ $? -eq 0 ];then
break
fi
done
done
#file2='/Users/jian.wang13/code/test/jingxiang.txt'
# 取出文件每行的拿一列
#file3=$(cat /Users/jian.wang13/code/test/jingxiang.txt)
for line in `cat /root/snap/jingxiang.txt`
do
# echo $line
units=(`echo $line | tr ',' ' '`)
# echo ${units[0]} ${units[1]}
docker pull ${units[0]} && docker tag ${units[0]} ${units[1]} && docker push ${units[1]}
done
echo '' > "/root/snap/jingxiang.txt"
@@@@@@@@@@@@@@@@@@@@@
后台执行 &>/dev/null &
边栏推荐
- Dspic33ep clock initialization program
- Go-3-第一个Go程序
- 不要再说微服务可以解决一切问题了!
- iframe
- websocket
- 磨礪·聚變|知道創宇移動端官網煥新上線,開啟數字安全之旅!
- 2022 chemical automation control instrument examination questions and online simulation examination
- TSQL – identity column, guid, sequence
- GBase 8c数据库如何查看登录用户的登录信息,如上一次登录认证通过的日期、时间和IP等信息?
- Wechat nucleic acid detection appointment applet system graduation design completion (7) Interim inspection report
猜你喜欢

Stop saying that microservices can solve all problems!

About the use of Vray 5.2 (self research notes)

R3live series learning (IV) r2live source code reading (2)

Characteristics and electrical parameters of DDR4

Operation of simulated examination platform of special operation certificate examination question bank for safety production management personnel of hazardous chemical production units in 2022

32:第三章:开发通行证服务:15:浏览器存储介质,简介;(cookie,Session Storage,Local Storage)

磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!

DDR4的特性与电气参数

How to introduce devsecops into enterprises?

【广告系统】Parameter Server分布式训练
随机推荐
Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework
A usage example that can be compatible with various database transactions
基础篇——REST风格开发
When using gbase 8C database, an error is reported: 80000502, cluster:%s is busy. What's going on?
购买小间距LED显示屏的三个建议
【DNS】“Can‘t resolve host“ as non-root user, but works fine as root
2022 mobile crane driver examination question bank and simulation examination
Golang application topic - channel
How to close the log window in vray5.2
32:第三章:开发通行证服务:15:浏览器存储介质,简介;(cookie,Session Storage,Local Storage)
Based on shengteng AI Yisa technology, it launched a full target structured solution for video images, reaching the industry-leading level
Characteristics and electrical parameters of DDR4
【广告系统】增量训练 & 特征准入/特征淘汰
基于OpenHarmony的智能金属探测器
如何让全彩LED显示屏更加节能环保
R3live series learning (IV) r2live source code reading (2)
Review the whole process of the 5th Polkadot Hackathon entrepreneurship competition, and uncover the secrets of the winning projects!
DDoS attack principle, the phenomenon of being attacked by DDoS
Function///
Question bank and answers of special operation certificate examination for main principals of hazardous chemical business units in 2022