标签:server sed usr cal serve for 参数 bash $@
实例脚本:br/>#!/bin/basharg=($@)n=0m=0sad=ls /usr/local/conf | grep test | sortsmile=ls /usr/local | grep test | sortfor slt in $smiledosed -i "s/.serverId./\t‘serverId‘ => ‘3${arg[$n]}‘,/g" /usr/local/${slt}n=$[$n+1]donefor sss in $saddosed -i "s/.server_name./\tserver_name ${arg[$m]}/g" /usr/local/conf/$sssm=$[$m+1]done
ls /usr/local/conf | grep test | sort
ls /usr/local | grep test | sort
传入多个参数依次修改文件(bash脚本)
原文地址:https://blog.51cto.com/11801990/2412452