簡體   English   中英

Bash shell 腳本 html css

[英]Bash shell script html css

while read row do
    echo "<tr>" >> $file
    for valore in $row 
    do
        echo "<td>$valore</td>" >> $file
    done
        echo "</tr>" >> $file
done < alunni.txt
    echo "</table>" >> $file

當我執行這部分代碼時,它給了我這個錯誤:

./table_html.csv: line 36: syntax error near unexpected token `echo'
./table_html.csv: line 36: `            echo "<td>$valore</td>" >> $file'

我如何解決它?

我不太擅長 shell 腳本,這就是為什么我想不出其他任何東西。

(啊,當烤箱的警報響起時,我正在研究這個)我想說的是,過了一會兒,它只是在錯誤的地方“做”了。 因此,這是您的代碼重述(添加了 file="filename" 以使其正常工作):

file="test2.html"
while read row 
do
    echo "<tr>" >> $file
    for valore in $row 
    do
        echo "<td>$valore</td>" >> $file
    done
        echo "</tr>" >> $file
done < alunni.txt
    echo "</table>" >> $file

所以這只是一個換行符,然后你需要做的就是:-)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM