Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote that script but if I run it I get this output:

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

The script is:

#!/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
share|improve this question
    
thanks for the help. but after i changed it i've still the same error – Qbongo 3 hours ago
1  
"I've changed it" You've changed what from what to what? Please be precise. – roaima 2 hours ago
while [ $key = "q"]; do

should be

while [ $key = "q" ]; do

and

if[$dateTex !eq $datePdf]

should be

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

not to mention

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

and the other similar line are broken and should be something like:

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.