Re: Date trouble
Re: Date trouble
- Subject: Re: Date trouble
- From: "Mark J. Reed" <email@hidden>
- Date: Mon, 23 Oct 2006 12:00:57 -0400
On 10/23/06, ishmael <email@hidden> wrote:
Thanks (also) for the minor disgression! it was useful, to me at
least...More or less on the same topic: you use %F instead of
%H:%M:%S, because is a "single-specifier shortcut"...what is a
single-specifier shortcut"?
The format string you specify via the + argument to the "date" command
has its own unique syntax, where sequences starting with % are
replaced by various interpretations of various components of the date.
I call those sequences "format specifiers" or "specifiers" for short
(although it appears the official term in the documentation is
"conversion specification"). So all I meant by the phrase
'single-specifier shortcut' was that the string '%F', which contains
only a single specifier, is equivalent to, and shorter than, the
string '%H:%M:%S'.
Behind the scenes, the date command eventually calls the C routine
strftime() to do the actual time formatting. The manual page for
strftime (which you can read by typing "man strftime" in a Terminal
window) includes the full list of legal specifiers.
where can i find some documentation on shell script, and this kind of things?
All over the place. There's an introductory tutorial here (though
you'll have to read past some Linux-oriented details):
http://www.freeos.com/guides/lsst/
If you want to learn general shell scripting, I recommend the
O'Reilly book _Classic_Shell_Scripting_:
http://www.oreilly.com/catalog/shellsrptg/index.html
hope it's not OT...
Not since they added "do shell script" to AppleScript, it's not. :)
Shell scripting, like AppleScripting, is traditionally a matter of
getting other application programs to work together. A lot of the
heavy lifting in a "classic" shell script is done by programs like
awk, sed, grep, cut, sort, etc, which were each designed to be very
good at solving one very limited set of problems (although awk
ventured into general programming language territory by itself). They
provided a quicker option than programming a custom solution in C. In
modern times, most of that functionality is available in scripting
languages like Perl, Python, Ruby, Tcl, and they're often a better
choice for more complex problems. If you're interested in learning
any of those, you'll find proponents of each of them on this list with
more specific advice. My only advice is not to get too evangelistic
about whichever one you choose. :)
Shell scripts are still handy, and they have the unique advantage that
the API is exactly the same as the way you use the commands
interactively. So learning to get around the Terminal helps you with
shell scripting and vice-versa.
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden