Saturday, November 04, 2006

ANSI Terminal Goodness and Sports

So this week I got around to one of those things I thought would be cool to do, but never had a good reason to get into. I started playing around with using ANSI Terminal escape codes in my bash script to stop scrolling so much text but update information. For what I needed, just 3 escape codes work, and it's good, I haven't used this in plain PERL prints but it should work from just about anything.

So to start, before I print anything on the line I print "[s" to save the cursor location. In vi (The only text editor of course.) I type [s to get it. The just actually puts the escape keycode into the text. While blogging this I looked it up and tested \e does the same thing. So in bash echo -en can be used for the commands. The other two I use to start every line after the first one is '\e[1K' followed by '\e8' . The first command clears the line from the cursor to the begginning, what you just typed, and the second moves the cursor to where it was when you did the '\e[s' . So to sum it up, here's a bash script to start you off



echo ; echo; echo -en '\e[s This is my first chunk.' ; sleep 2 ; echo -en '\e[1K\e8 This is my second chunk' ; sleep 2 ; echo -en '\e[1K\e8 This is the last chunk' ; sleep 2 ; echo ; echo




So that was my fun with ansi terminal stuff this week, it will dress up all the PERL scripts I whip up at a moment's notice to do some thing. So, for sport now.

Well, I watch football. It's the only SPORT I watch (That and Poker which is really a game anyways.). Now one of my friends is all about baseball and I can't stand it. I mean it's so boring. Maybe the hand-eye coordination to hit a ball from a MLB pitcher is the hardest thing to do, but I agree with a family member who said "that doesn't make them great atheletes". Now I could watch Hockey, Soccer, or Basketball, and if I do then I'm done with the NFL. Even the NFL just takes too much time out of my day. I like the sport of football though. Even if there is more variance in the players from week to week. I mean who really know Minnessota would be completely dominated by the Patriots. But I loved watching Brady pick apart the defense (Man, I'm not a PAts fan but I'm finally at a place where I can say Tom Brady's a great Qb. And I think Peyton will be the next Marino who everyone says is great but didn't have the mustard to finish things and carry a team to the championship. If he does it will ONLY be because he didn't have to get through a Defense who could get to him. So Indianapolis lives and dies by it's offensive line.)

Anyways, if the penalty / officials got to something reasonable, and I blam it SOLELY on the NFL heads who make the rules changes, so that pass interference and some other rules make sense, then I'd never watch anything else. But as it is, maybe I'll pick hockey back up as my sport.

0 Comments:

Post a Comment

<< Home