Simon,

        There's about 50 different ways to do something like this, you could
exec the date command and then parse out the result, or you could exec the
date command manny times with 'format' options, or... 

        Personally, I'd probably exec the date command with format options.
Something like this:

set Month       "[exec date +%B]"
set Year        "[exec date +%Y]"
set Day         "[exec date +%A]"
set datestring "$Day $Month $Year"

        I'm unsure what exactly it is your trying to do, but I get the
feeling that your not formatting things out right. 

        Note, you don't _have_ to use quotes when setting some of those
variables up above, I just do. It's a force of habit from my old BASIC days.
:)

        -Jeff


> 
> This is a dumb question, but as I am really new to this Tcl
> programming stuff, I would really appreciate a pointer in the right
> direction.
> 
> My problem is that I am trting to exec the GNU date comand inside a
> command to obtain the day of the week that a certain date falls on.
> The code I am using to try this is:
> 
> set tvMonth January
> set tvYear 1997
> set a "date -d '1 "
> set b "' +%a"
> set datestr [concat $a $tvMonth $tvYear$b]
> set tvDay [exec $datestr]
> 
> Now, I was hoping that tvDay would contain the day, but when I run
> this piece of code I keep getting a message telling me that the
> command "date -d '1 January 1997' +%a" is not a file or directory. I
> have tried putting the path in the command but am still getting the
> same error.
> 
> I amsorry if this is very basic stuff, or if I should not really be
> placing the message in this mailing list, but I am slowly driving
> myself mad trying to work out why this code will not cooperate.
> 
> Thank you for your patience and, hopefully, answers.
> 
> Simon Richardson
> 
> P.S. If this is not the correct place to be mailingthese sorts of
> questions, and in an effort not to waste too many people's time, can
> anyone suggest somewhere else that I could get answers to this sort of
> thing from?
> 
> 
> --
> *********************************************************************
> *    //                     *   Simon C. Richardson                 * 
> * _ //  Surfing Amiga style *   Home: [EMAIL PROTECTED]     *
> * \X/                       *   Work: [EMAIL PROTECTED]  *
> *********************************************************************
> 
> -----BEGIN PGP PUBLIC KEY BLOCK-----
> Version: 2.6.3i
> 
> mQBtAzMGevMAAAEDAKWwXlPrny4kin+ZM6yEmRpJR2eB3VXdplxD8UL4V4V9ZL6S
> Fljw3al99uHJfOBJgqyS6pX9wcbmjwrJ3Ltt7Tg4ZKvcjCkJGA69PV/WGq62pXes
> wX7bcfkBADXzOHQRSQAFEbQsU2ltb24gUmljaGFyZHNvbiA8c2ltb25AYmFsdGhh
> ci5kZW1vbi5jby51az6JAHUDBRAzBnr0AQA18zh0EUkBAezlAv9NXAlWZj3Pse+9
> e/O/BxlPykXU+Yt+jj15VYtUQax/XaXcnJA7F0dVavb3Kt/WHxXtrNTmXJeSqNws
> cp10xo2HWFijJ/TJ+bxwEiaYs6yO/Nw4VmmBUIkAw0HUu1qSxqQ=
> =TKyO
> -----END PGP PUBLIC KEY BLOCK-----
> 
> 

Reply via email to