Companionway

Meeting challenges with success

Sometimes It Is The Obvious

This was one of those “problems” that nagged me for many hours until the obvious dawned on me. I wrote a python script to grab the temperature and humidity from a DHT22 sensor and then write the output with the proper syntax to send to my monitoring program [xymon]. The wrapper bash script ran every 5 minutes and used a redirection to write out a file ie:

*/5 * * * * /usr/local/bin/temphum.sh >/tmp/temphum.dat

The wrapper script grabs output and sends it to the server. Having this wrapper script lets me run the python script independently for testing or for curiosity.


shell/bash uppercase arguments

turning your commandline arguments into uppercase

To make a long story short…

#!/bin/bash
PATTERN=$(echo $1 | tr [:lower:] [:upper:])
# or
PATTERN=$(echo $1 | tr [a-z] [A-Z])
# or
PATTERN=$(echo $1 | awk '{print toupper($0)}')

echo "Your \$1 argument is now uppercase: $1"

To make a short story long…

Just to let you know a little more about me and reveal a few more shells tricks along the way.

I am a very conservative investor - always have been but the low interest rates over the recent past has forced me to try a squeeze a little more out of the stock market also known as a “a gentleman’s gambling parlor of greedy people”. To do this I have been using covered secure puts and covered calls (did I mention that I am conservative?). So what does this have to do with the title here?