Friday, January 24, 2014

We Can't Stand

I just can't stand it anymore...

...this year really is off to a bad start. Let me explain: I live a block away from a Fire House (some call it a Fire Station, Hose House, or whatever). But it isn't the fire trucks or the constant backup-beeps that are about the station that piss me off, its that damn air-raid siren. They use it for EVERYTHING. Car Wreck? YES!  Fender-Bender? YES!  Power-Outage? YES!  Hang Nail Emergency? PROBABLY!  Fire?? Cant tell!   An Actual National Emergency (like an air raid)?? Can't tell!   Parade Starting? YES!   Fireworks display starting? YES!  High school prom starting? YES!  and by far the worst is, every first Saturday (and last Saturday, to a lesser extreme) the initiate a 5-minute TEST where the siren blows without pause, then right after that, they do another 1 minute test. They use it DAILY, why the hell do they need to test it???  And if there were ever an emergency, who would know?? Haven't cell phone.. i mean, telephone, wait, radios.. or even hoses with funnels at each end been invented??   Why use an AIR RAID SIREN every time there is a minor accident??  They claim it is for the volunteer firefighters, but it seems to me we have C.B.s for the last 3 or 4 decades at least.  It's a bunch of old farts in good old Pennsylvania keeping this going, sounding them for no good reason makes them feel better somehow...  maybe they do it to clean their otherwise useless ears out so they can hear even less so when I go to a stop sign I get ran into because they can't think because a siren has permanently drove them insane, which is WHY it still happens!!  And who are the grand children taking over this operation?? WHY HAS NOBODY DONE ANYTHING ABOUT THIS YET!! Even our ancient first ward has a Facebook page, but we still need air raid sirens??? Where does the insanity stop????? Bang! I just shot myself in the head *dead* (and they will probably sound the air raid siren for that too!)

* This post was written on January 4, 2014, but was in draft, it was placed into publication on January 24 (20 days later) after being completed.

Invert the case of a bash variable (bash scripting, ie, THIS IS A test -to- this is a TEST)

${V~~}, the (undocumented?) invert case expansion??


I stumbled upon this by accident, my bad memory is to blame for it, but it seems to be undocumented so I thought I would blog it out since nobody seems to have done so.

Under bash 3.x, I was trying to convert a path to lowercase which is done by ${VAR,,} but accidently used ${VAR~~} note: the worm characters, and got this interesting result (command results are in bold):


localhost ~$ TEST="THIS IS A test string"
localhost ~$ echo ${TEST~~}
this is a TEST STRING
localhost ~$ echo ${TEST,,}
this is a test string
localhost ~$ echo ${TEST^^}
THIS IS A TEST STRING
localhost ~$_


I went back to the man page, a few stack-exchange sites that I frequent, and found no trace, not even in Google, of this odd extra. I'm wondering if it is a remnant of POSIX compatibility forgotten, or did the documentation accidentally leave it out or forget about it? Either way, it is good to know, and now you know too. If I get around to it, I'll have to contact the developer(s) responsible for the current upkeep of bash, which may be hard since it seems many projects are forked and may very well affect multiple projects under multiple distributions, even perhaps as far as crossing the Linux <-> BSD barrier. I would think from what I've seen this could be challenging so I am notoriously lazy and it could be 5 or 10 years before I do. Anyone interested in taking this up, let me know, I'm very interested to hear. I respond to comments on the blog, that's the best way I think, or write me a post on one of the Q&A sites I use often: AskUbuntu, StackOverflow, ServerFault or, SuperUser.