Wednesday, December 19, 2007

and...

needing to send mail from within a batch file...(no 'mail' app like on nearly all unix) no, I don't want to mess with MS mail profiles etc...blat works well. I even managed to get it going as a non-administrator.

datestamps

hooray. I have a new job doing server/middleware support. Even better: a co-worker asked me to do something - convert a unix shell script to run on a Windows 2003 server. Aside from the lines dealing with an Oracle client - they want a datestamp in the reports:

from the familar unix one-liner:

now =`date +'%Y%m%d%M%S'`

to the following horror:

REM generate timestamp!

@for /F "tokens=2,3,4 delims=/ " %%A in ("%date%") do @(
set day=%%A
set month=%%B
set year=%%C
)
@for /F "tokens=1,2,3 delims=: " %%A in ("%time%") do @(
set hour=%%A
set minute=%%B
set sec=%%C
)
REM cleanup the seconds string
@for /F "tokens=1* delims=. " %%A in ('echo.%sec%') do @(
set sec=%%A
)

set timestamp=%year%%month%%day%%hour%%minute%%sec%

& of course, this will break if the locale is not Australian dates...yuk. Hope I'm not being naive in that. A solution might be to do more in VB (which I do know) or install Perl on everything.

Monday, December 17, 2007

age-old vi/vim question

how to make the arrow keys work in insert mode. Another one that I probably fix a few times per year & then forget how to do. Irrespective of whether this is a good idea or not: adding ":set nocompatible" to your .vimrc file fixes this. This appears to work on ubuntu & Red Hat Enterprise.