LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-11-2012, 08:34 AM   #1
Dyspeptic Curmudgeon
LQ Newbie
 
Registered: Feb 2012
Posts: 6

Rep: Reputation: Disabled
vim flags a for loop error depending on file extension in the 'for' line?


Found something really weird.
Writing a 'for' loop in vim, with #!/bin/bash as first line, so vim knows this is a script and turns on colour highlighting, brace matching etc.
# **********
count=0
for file in *.tif ; do
# an attempt at ocr'ing a page
let "count = count + 1"
done

but vim highlights the 'done' in red as being an error.
Removing *ONE* '"' from the 'let' line clears the 'error'...Huh?
So the 'error' is triggered above that point....

Changing the file extension from '*.tif' to '*.tiff' clears the error.

So, does anyone know *WHY* this happens? How/why does *vim* parse text for the file extensions? Is 'tif' a keyword for an extension? If so, what are the others?
I find this most intrigueing (although a work-around is easy!)
 
Old 09-11-2012, 08:37 AM   #2
Dyspeptic Curmudgeon
LQ Newbie
 
Registered: Feb 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Adding to my post: it is NOT bash, it IS vim.

In a console:
for file in *.tif; do mv ${file} ${file}f ; done

works perfectly, with no flagged 'error'.
 
Old 09-11-2012, 08:49 AM   #3
Dyspeptic Curmudgeon
LQ Newbie
 
Registered: Feb 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
False alarm! Exceedingly opaque sleight of hand causes digression in the wrong direction.

It turns out to be one of the command switches in the ocr command which causes vim to choke

The command line is abbyyocr9 -if $count.tiff -f Text -of ../text/$count.txt

Vim burps on the 'if' in that command line. Bash does not. So I am using --inputFileName from here on.
Something to remember if things go wrong (pun intended).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
BASH: Read entire file line in for loop clinton Programming 16 04-18-2013 12:06 PM
[SOLVED] vi / vim editor - how to display text file one line on one row ? masuch Linux - Newbie 3 08-06-2012 09:14 AM
VIM runs into an indefinite loop while editing a large file xuancong Linux - Software 1 04-12-2011 08:56 PM
How can I read a file line by line and add it to a loop in another file? astroumut Linux - Newbie 7 08-24-2009 04:37 AM
serial line loop back error in dial-up mahdif Linux - Networking 0 07-05-2007 01:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration