Linux Today: Linux News On Internet Time.





More on LinuxToday


quote-count: A debugging tool for shell scripts

Dec 17, 2010, 22:03 (0 Talkback[s])
(Other stories by jhansonxi)

WEBINAR:
On-Demand

Full Text Search: The Key to Better Natural Language Queries for NoSQL in Node.js


[ Thanks to jhansonxi for this link. ]

"I've been doing a lot of shell scripting lately with Dash and Bash. Complicated scripts with lots of text handling make debugging difficult, especially when they are being used in sub-shells which obfuscate line numbers in error messages. One of my more common mistakes is an unmatched quote. These can be rather difficult to find so I wrote quote-count, a simple analysis tool that counts quotes in lines.

"It just accepts a single filename as a parameter and counts single, double, and back quotes on each line and prints their totals. It prints out a warning if the any of the counts is odd-numbered which may indicate a mismatched quote. It also warns if the line is a comment so you easily ignore those."

Complete Story

Related Stories: