August 05, 2003 01:25 AM

No More DATE_CMD

I wanted to improve the ability to change an entry's date format, so I think I came up with a decent solution. The problem before, was that I needed to find a simple way to read in the DATE_CMD variable from blog.conf, so I just relied upon whatever "date" spat out. I never thought of testing it with a custom date string, but when I did, I was surprised that it didn't work. So, I came up with a quick and dirty solution; putting backquotes into blog.conf's DATE_CMD.

I originally intended the DATE_CMD variable to be equal to a single command, so it wouldn't be too "date" command specific. I finally, just embraced the "date" comand in the end. The DATE_CMD variable would need some extra help from the script, to be able to process the date string, so I wrote a function to filter the date string to more of an executable format and then filter the output back to normal.

The DATE_CMD variable had to be renamed for a more logical fit, so I renamed it to DATE_FORMAT. Now insted of "`date '+%B %d %r'`", DATE_FORMAT will consists only of the date's string e.g. "%B %d %r". The date command is called within the function with the custom DATE_FORMAT variable.

My changes can be found in the unstable version, from my downloads page. Now, I can finally get some rest!


Posted by n1xt3r | Permanent link | File under: developer-notes | Comments: (0)

0 comments

Comments are closed

If you really, really want to comment, please mail n1xt3r@fastmail.fm