重要な問題

重要な問題

スクリプトを作成しましたが、実行すると、次のような結果が表示されます。

./autotex: line 7: syntax error near unexpected token `then'
./autotex: line 7: `            then'

スクリプトは次のとおりです。

#!/bin/bash

while [ $key = "q"]; do

        dateTex = grep $1.tex| cut -b 43 - 54
        datePdf = grep $1.pdf| cut -b 43 - 54
        if[$dateTex !eq $datePdf]
        then
                pdflatex $1.tex
        fi

        read -t 1 -n 1 key

done

ベストアンサー1

while [ $key = "q"]; do

しなければならない

while [ $key = "q" ]; do

そして

if[$dateTex !eq $datePdf]

しなければならない

if [ "$dateTex" != "$datePdf" ]

言及する必要がない

dateTex = grep $1.tex| cut -b 43 - 54

別の同様の行が壊れて、次のように表示されます。

dateTex=$(grep something $1.tex | cut -b 43-54)

おすすめ記事