我有一个循环将一些行添加到配置文件中:
for i in ${H//,/ }
do
sed -i "7i\ host($i) or" $configPath/$g.conf
done
Run Code Online (Sandbox Code Playgroud)
$H 是逗号分隔的变量,例如:host1,host2,host4,host10
它返回以下内容:
Run Code Online (Sandbox Code Playgroud)host(host10) or host(host4) or host(host2) or host(host1) or
但我想要实现的是:
Run Code Online (Sandbox Code Playgroud)host(host10) or host(host4) or host(host2) or host(host1)
或相反亦然:
Run Code Online (Sandbox Code Playgroud)host(host1) or host(host2) or host(host4) or host(host10)
谁能帮助我找到正确的方向,我怎样才能做到这一点?
bash ×1