2017-10-16 90 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

那就是它!十分感謝 ! –