Showing posts with label shell scripts. Show all posts
Showing posts with label shell scripts. Show all posts

Tuesday, January 5, 2010

Your Script ...

Caution: This might get a bit geeky -- but, I still hack a bit to pay for all of this.

Today, I wrote a very short tcl script that executed a mysql query from the command line in a unix shell, spitting back the results less than gracefully. In short it was a quicky hack to provide some functionality, i.e. visibility into a database.

It started like this:

#!/bin/sh \
exec /usr/bin/tclsh "$0" ${1+"$@"}
# end of excerpt

"What is this (regarding these two lines) and ... what's it for?" asks one of my coworkers. I hadn't really thought about it for several years. "It gets around a 32 character magic line length limitation for long path names ... blah, blah, blah. It's habit," I say, "dressed up as good practice." spitting back stuff I was taught by this guy. I went and lookeditup. The truth is ... I have written programs in tcl on various flavors of unix, including SCO and 4.xBSD and HPUX 9.x (these are all pretty archaic systems at this point) and worked in a place with 20 flavors of tcl spread all over a huge system. This was the best way to do it. Now, most of these systems are located in back dusty rooms, running archaic legacy systems, and probably won't be running any of my scripts ... but my scripts will still be up to it.