2 Replies - 968 Views - Last Post: 03 November 2008 - 06:52 PM Rate Topic: -----

#1 yofat04  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 17-July 08

Shell script help

Post icon  Posted 02 November 2008 - 06:53 PM

I am writing a C shell script that is suppose to read "file" and checks it for spelling of the words it contains. wordspell is invoked interactively. For each word that is found to be incorrect, the invoker is asked for either:
to insist on the spelling of the word.
to provide a replacement spelling
If the invoker insists on the spelling of the word, then this word is added to wordspell's "memory". wordspell remembers words in the file "memory" in the invoker's home directory. Any further invocation of wordspell by the same invoker will consider the word to be correct.

I am getting these errors with my code:

./wordspell: line 9: syntax error near unexpected token `newline'
./wordspell: line 9: ` set choice = $<'

#/bin/csh


touch ~/memory.txt

while (`ispell -l ~/memory -l  < $1`)
		echo "$1 is mispelled"
		echo -n "Press enter to keep this spelling, or"
		echo -n "type a correction here: "
		set choice = $<

		if (choice== "" )then
				ispell -I
		else
				ispell -R choice >> ~/memory.txt
		endif

end




Can anyone help me understand what im doing wrong?
And since my script wont even run I cant find out if it works or not so if see see any errors in my script can you point them out to me.

Is This A Good Question/Topic? 0
  • +

Replies To: Shell script help

#2 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: Shell script help

Posted 03 November 2008 - 09:40 AM

It's been a while... :)
Shouldn't the line while (`ispell -l ~/memory -l < $1`) be while (`ispell -l ~/memory.txt -l < $1`)

This post has been edited by n8wxs: 03 November 2008 - 09:40 AM

Was This Post Helpful? 0
  • +
  • -

#3 yofat04  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 22
  • Joined: 17-July 08

Re: Shell script help

Posted 03 November 2008 - 06:52 PM

View Postn8wxs, on 3 Nov, 2008 - 08:40 AM, said:

It's been a while... :)
Shouldn't the line while (`ispell -l ~/memory -l < $1`) be while (`ispell -l ~/memory.txt -l < $1`)


No the line was fine. my ta pointed out that my "she-bang" line was incorrect. I should have had:
#!/bin/csh



instead of:

#!/bin/csh



Thank you for the help though
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1