使用eval用变量的值作为新的变量名 博客分类: linux
程序员文章站
2024-03-19 11:12:46
...
[root@localhost ~]# x_mm="yyy" [root@localhost ~]# s=x [root@localhost ~]# cat test.txt alt="yyy/20150823020537310.jpg" src= asdasd asdasdasdasd cvdawsdas [root@localhost ~]# sed -i s"#$(eval echo $`echo $s`_mm)#xxx#"g test.txt [root@localhost ~]# cat test.txt alt="xxx/20150823020537310.jpg" src= asdasd asdasdasdasd cvdawsdas