当前位置:网站首页>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 &
边栏推荐
- Process control
- C language current savings account management system
- Go language learning notes - first acquaintance with go language
- Beego cross domain problem solution - successful trial
- 如何让全彩LED显示屏更加节能环保
- 华为设备配置信道切换业务不中断
- 基于昇腾AI丨爱笔智能推出银行网点数字化解决方案,实现从总部到网点的信息数字化全覆盖
- 中职组网络安全C模块全漏洞脚本讲解包含4个漏洞的脚本
- 关于vray 5.2的使用(自研笔记)(二)
- 谈谈对Flink框架中容错机制及状态的一致性的理解
猜你喜欢

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

Codeforces Round #804 (Div. 2)

Go language learning notes - first acquaintance with go language

Wechat nucleic acid detection appointment applet system graduation design completion (8) graduation design thesis template

Repair animation 1K to 8K

Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework

基于昇腾AI丨爱笔智能推出银行网点数字化解决方案,实现从总部到网点的信息数字化全覆盖

Detailed explanation of DDR4 hardware schematic design

Web3基金会「Grant计划」赋能开发者,盘点四大成功项目

基于昇腾AI丨以萨技术推出视频图像全目标结构化解决方案,达到业界领先水平
随机推荐
deepfake教程
Process control
Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework
Taro advanced
如何将 DevSecOps 引入企业?
Scaffold development foundation
Applet framework taro
数据类型 ntext 和 varchar 在not equal to 运算符中不兼容 -九五小庞
不要再说微服务可以解决一切问题了!
Array
Go-2-Vim IDE常用功能
[SWT component] content scrolledcomposite
BOM//
力扣(LeetCode)185. 部门工资前三高的所有员工(2022.07.04)
Based on shengteng AI Aibi intelligence, we launched a digital solution for bank outlets to achieve full digital coverage of information from headquarters to outlets
Some understandings of heterogeneous graphs in DGL and the usage of heterogeneous graph convolution heterographconv
Explanation of full vulnerability script of network security C module of secondary vocational group script containing 4 vulnerabilities
Node の MongoDB Driver
Nuxt//
Huawei equipment configures channel switching services without interruption