Monday, February 5, 2018

Drinking on a budget: Dollar Tree martini glasses!

We had a very nice set of (I think) six martini glasses, some well-known brand, that we bought as a set perhaps somewhere around five years ago. Every year or so, I accidentally break one of the glasses by dropping it, or the dishwasher decides it's time to crack one of them. So now I'm down to one and it was time to restock. But, I'm on a budget here in Miami. The solution: Dollar Tree!

What could be simpler? They look great. They hold as much as our previous martini glasses, though they look a tiny bit smaller. They also seem a bit sturdier as far as glass and stem thickness. They clean up very nice in the dishwasher. And they're only a dollar each. I'm sold!

I think we're not the only ones sold on Dollar Tree martini glasses. We went to a very famous local restaurant recently, one known for crab claws, and they served us a round of cocktails in glasses that looked suspiciously like these ones. Can't say that I blame them, especially if these are sturdier than average.

Thursday, February 1, 2018

Linux: Redirecting or Silencing Script Output

I've been writing shell scripts on *nix systems for more than twenty years. You'd think that by now I'd have this memorized, but I don't. Since I'm tired of looking it up every time, I'll post this here so that it can help jog my memory next time around.

Repeat after me: redirecting stderr and stdout is easy.

To run your script while silencing any and all possible output, execute it like this:
./ > /dev/null 2>&1

To silence it only when it runs via cron, to make it not send you an email after it runs, put it in your crontab like this:
0 5 * * 1 /home/aiverson/ > /dev/null 2>&1
(all on one line)

If you're running a command inside a script and you want to capture both possible errors and standard  output in the same way, so that you can parse it easily, do this:
OUTPUT=`lynx -dump "http://website" 2>&1`
If you don't add the 2>&1, any error message returned by lynx is sent to the active window running your script, instead of into the $OUTPUT variable.