linux - 一次循环两个变量的shell脚本

标签 linux bash shell sh

我是 shell 脚本的新手,我正在尝试编写一个小的 shell 脚本来在每台服务器上执行一些操作。下面是我的脚本

servers_list=$(curl -s http://localhost:8080//upstream_conf?upstream=backend\&id | awk '{print $2}' | cut -f1 -d":") id_list=$(curl -s http://localhost:8080//upstream_conf?upstream=backend\&id | awk '{print $5}' |cut -f2 -d"=") 服务器=10.0.10.1 10.0.10.2 id=0 1

根据 id 列表,我需要分别在每个服务器上执行操作。

注意:服务器10.0.10.1 id=0 服务器 10.0.10.2 id=1

最佳答案

如果你使用标准配置面板,有一个插件

https://wiki.jenkins.io/display/JENKINS/Parameterized+Build

您可以选择 bool 值(复选框)或选择(字符串列表)或简单的文本字段等参数。您将无法使“选项 A 取消选择使选项 B 禁用”,但无论如何这工作得很好。

关于linux - 一次循环两个变量的shell脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45486955/

相关文章:

c# - 在 systemd 文件中使用 Environment= 解析 ASP.NET Core 连接字符串

linux - 由 bash 脚本而非脚本本身启动的终止进程

linux - linux系统调用mmap(2)和posix mmap(3)函数有什么区别?

linux - Bash 免费命令停止工作

linux - Mercurial - 以其他用户身份执行

python - 我们如何使用 python 从 ssh 代理运行 tmux

linux - HR 计时器精度研究案例

linux - 带 CGI 的 Shell 脚本适用于 bash 但不适用于 sh

linux - 如何正确打印作为参数传递给 Bash 函数的字符串?

shell - 将文件中的行读入 shell 脚本中的 2 个变量