Cynosure.X International LLC

: :

Add Comment | Related Links | TrackBack
Related Content

MissingEndQuote.ksh (GPL)

It's quite common to forget an end quote when writing shell programs. Only when you execute it do you get a cryptic message (shown below) that you've forgotten an end quote. The error message always points to the end of the script file, not the line where the quote started. This "MissingEndQuote.ksh" script is the answer to this rpoblem.

  line 103: unexpected EOF while looking for matching `"'
line 106: syntax error: unexpected end of file

"MissingEndQuote.ksh" parses the script file you pass in as a command-line argument. It searches for begin single-quote, double-quote, and back-quote that does not have a end quote. And then it output the offending line number and the line of code. The only catch is that begin and end quotes must be on the same line.

"MissingEndQuote.ksh" takes advantage of the IsOdd.sh (GPL) script and the SubString (Freeware) Java software, which are also available on this site. So to use this script, you will need to download these other two programs if you don't already have them.

"MissingEndQuote.ksh" is distributed as executable source code under the GNU General Public License. Please see the license agreement elsewhere on this site.

Usage

  MissingEndQuote.ksh "file"

Attached File: MissingEndQuote.ksh (1 KB)

Chieh Cheng
Sat, 21 Mar 2009 00:00:55 +0000

"MissingEndQuote.ksh" executes quite slowly, because it needs to extract each character to count. There is no easy way to extract characters in a shell script, so that it is forced to call SubString. I thought, perhaps, that loading the Java interpreter was slowing it down. So I implemented SubStr.sh recently, using grep to extract the characters. But it turned out that SubStr.sh was even slower than SubString. The following are the time stamps of running each version of "MissingEndQuote.ksh".

# using Java SubString
# Mon Mar 30 17:54:27 PST 2009
# Mon Mar 30 17:56:06 PST 2009

# using SubStr.sh
# Mon Mar 30 17:47:31 PST 2009
# Mon Mar 30 17:53:43 PST 2009

It turned out that using Java SubString is three times faster than using SubStr.sh. If you know an even faster way to speed up "MissingEndQuote.ksh", please let us know, because so far, I found this utility to be quite useful.

Chieh Cheng
Tue, 07 Apr 2009 21:08:59 +0000

On a happier note, I have made changes to "MissingEndQuote.ksh" so that it shows progress output. It's a lot easier to wait for "MissingEndQuote.ksh" to finish if you have an idea where it's at. The newer version of "MissingEndQuote.ksh" is attached below.

Attached File: 1 - MissingEndQuote.ksh (1 KB)

Chieh Cheng
Tue, 07 Apr 2009 21:10:16 +0000

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

Add Comment

Spam Control | * indicates required field
Your Name: *
E-mail:
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 3 + 0?
Click button only once, please!

TrackBack

TrackBack only accepted from WebSite-X Suite web sites. Do not submit TrackBacks from other sites.

Send Ping | TrackBack URL | Spam Control

No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.

Messages, files, and images copyright by respective owners.

Products | Services
Forums | Latest | RSS
Library | Search | Wiki
Help | Licenses

Login | Register

51 Users Online

Hacking Digital Cameras
Fun for Photographers



Amazon Associate

Copyright © 1996 - 2024. All Rights Reserved.