Summary Part II Over-thinking find and mv - need a nudge

From: Brian Dunbar <Brian.Dunbar_at_plexus.com>
Date: Fri Mar 30 2012 - 09:55:33 EDT
Problem
Need to move files from a list of directories, rename them.


Solution
Use a for .. do .. done loop inside the for .. do .. done loop.  And using
basname and dirname.

Brett Lymn replied with a real clever tweak: play with your TZ setting in
shell.

"Play with TZ:

[blymn@mallee] TZ="GMT-10:15" date
Friday, 30 March 2012  9:54:16 AM GMT
[blymn@mallee] date
Friday, 30 March 2012 10:09:22 AM CST

My timezone is normally +9:30 and +10:30 in daylight savings, we are
still in daylight savings at the moment so TZ="GMT-10:30" date would
give the same date as date, by slipping the TZ around you can get a date
in the past or the future...it works for > 24 hours too so you can get
tomorrows date with TZ="GMT-34:30" and yesterdays date with
"TZ="GMT+13:30" (-10:30 - 24, wrap on 24 gives +13:30).

The only hairy bit is if you are in daylight savings or not but you
should be able to ask date that.

This seems to be a very little known feature of the timezone code but it
does appear to be portable, at least between BSD, linux, hpux & solaris."


Also works in OS X ...

~  date
Fri Mar 30 08:09:28 CDT 2012
~  TZ="GMT-10:15" date
Fri Mar 30 23:24:43 GMT 2012
~  date
Fri Mar 30 08:09:50 CDT 2012
~  uname -a
Darwin beatha.neenah.na.plexus.com 10.8.0 Darwin Kernel Version 10.8.0: Tue
Jun  7 16:33:36 PDT 2011; root:xnu-1504.15.3~1/RELEASE_I386 i386


Brian Dunbar
Systems Administrator

Plexus Corporation
Desk: (920) 751-3364
Cell: (920) 716-2027
email: brian.dunbar@plexus.com
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Fri Mar 30 08:56:03 2012

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:44:19 EST