setParameter.sh 

#!/bin/sh

 
if [ $# -eq 3 ]; then
    sed -i 's/<'"$1"\>'.*</<'"$1"'\>'"$2"'</g' $3
else
   echo error
fi

 原始xml文件:

/home/test.xml

 <cellphone>

<android>1000</android>

 <apple>200</apple>

</cellphone> 

 

 执行命令

 ./setParameter.sh  apple 800 /home/test.xml

 修改后的xml文件:

/home/test.xml

 <cellphone>

<android>1000</android>

 <apple>800</apple>

</cellphone>  

 

 

 

相关文章:

  • 2021-07-24
  • 2021-06-20
  • 2021-04-28
  • 2021-09-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-20
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
  • 2021-04-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案