2017-10-16 91 views
0

所以我想在我的网站中创建200个页面,为此我想在style.css中添加几行。我想在文件末尾添加下面的行将行添加到style.css中

.wordpress 
     width: 100% 
     position: relative 
     font-size: 22px 
     color: #1a1a1a 
     font-weight: 600 
     min-height: 297px 
     line-height: 22px 
     background: url(../images/wordpress.png) no-repeat left top 

我想用脚本替换文件名。有人可以指导我如何做到这一点?我试过以下技巧,但它的工作

for i in $(cat list1.txt) ; do echo .$i{\ width: 100%;\ position: relative;\ font-size: 22px;\ color: #1a1a1a;\  font-weight: 600;\ min-height: 297px;\ line-height: 22px;\ background: url(../images/$i.png) no-repeat left top;\} >> list3.txt ; done 

是否有任何其他方式来做到这一点?我在list1.txt文件中包含所有文件名

+0

你想改变list3.txt(由新线和无.png格式separeted)一个来自list1.txt的文件名?或者你想改变一个文件名的CSS类名? –

+0

你好在list1.txt文件我有文件名lilke wordpress.png joomla.png magento.png我想添加那些在list3.txt –

+0

我已经将style.css复制到list3.txt。如果这个脚本工作,我会更新style.css –

回答

0

我改变了一下你的代码。现在,它应该工作:

for i in $(cat list1.txt) ; do 
    echo ".$i{ 
     width: 100%; 
     position: relative; 
     font-size: 22px; 
     color: #1a1a1a;   
     font-weight: 600; 
     min-height: 297px; 
     line-height: 22px; 
     background: url(../images/$i.png) no-repeat left top; 
     }" >> list3.txt ; done; 

你应该list1.txt这样的:

wordpress 
joomla 

+0

那就是它!十分感谢 ! –