shell script syntax

I've started learning the shell script and I got this error when executing the following script.  Need help solving this.

the error I got:
./testsc: line 11: [: missing `]'
./testsc: line 11: [: missing `]'

and line 11 is:
while [`head -1 ./temp` -neq 'Finished']   # check if the first line is not "Finished"
  do
     # grab four lines and save it under file result
     head -4 ./temp >> result

     # remove the first 12 lines. The next meaningful data is at line 13
     sed '1,12d' ./temp > ./temp
  done
screwdriverAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
slyongConnect With a Mentor Commented:
while [ `head -1 ./temp` != 'Finished' ]   # check if the first line is not "Finished"

                                     ^^ when comparing string use !=, ! -eq is for comparing integer...
0
 
slyongCommented:
while [ `head -1 ./temp` -neq 'Finished' ]   # check if the first line is not "Finished"
          ^                                             ^
put space after [ and before ]
0
 
screwdriverAuthor Commented:
got different error now:
./testsc: line 11: [: -neq: binary operator expected
./testsc: line 11: [: too many arguments
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
TintinCommented:
slyong

-ne is for comparing integers.
0
 
slyongCommented:
Thank Tintin.. my bad.. I always negate the -eq using !.
0
 
screwdriverAuthor Commented:
Thank you guys, it works now.
0
All Courses

From novice to tech pro — start learning today.