2017-10-16 7 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変更したいですlist1.txtのファイル名?またはファイル名でCSSクラス名を変更したいのですか? –

+0

こんにちはlist1.txtファイルで私はファイル名がありますlilke wordpress.png joomla.png magento.png list3.txtにそれらを追加します。 –

+0

私はlist3.txtにstyle.cssをコピーしました。このスクリプトが動作すれば、私は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しておく必要があります(新しい行でと.PNGなしsepareted)

wordpress 
joomla 

+0

それはそれです!本当にありがとう ! –

関連する問題