interpreter to use by "echo"ing an association string into the
/proc/sys/fs/binfmt_misc/register pseudo-file. In this case, we want to the
string to indicate that any 'executable' file with the 'extension' of .mp3
is to be interpreted by /usr/bin/xmms, so the registration strings are
echo ":xmms:E::mp3::/usr/bin/xmms:" > /proc/sys/fs/binfmt_misc/register
echo ":mps:E::mp3::/usr/bin/xmms:" >/proc/sys/fs/binfmt_misc/register
echo ":ogg:E::ogg::/usr/bin/xmms:" >/proc/sys/fs/binfmt_misc/register
echo ":m3u::E:m3u::/usr/bin/xmms:" >/proc/sys/fs/binfmt_misc/register
Now, when we (as a regular user)
~ $ chmod u+x my_life_changed.mp3
and then
~ $ my_life_changed.mp3
up pops XMMS and the music plays on.
The format and variations of the "registration" string are documented in
/usr/src/linux/Documentation/binfmt_misc.txt.
Kewl, eh?
My thanks to Michael Heiming and Chris F. A. Johnson for pointing out
how to do this.
____________________________________________________
Two cent tip: ISO 8601 dates
Rick Moen ([80]LG Contributing Editor)
On wondering if his tip was lost entirely. We don't always publish tips in
the same month that we get them. -- Heather
No, they've always been sent to tag@...
(!) [Heather] Strictly speaking, 2c tips began as good bits from people
who weren't the Answer Guy. They tended to be, but weren't always, short,
and were handled by the editor - I only did the TAG column. After some
point I got involved with formatting tips as well, and then they were
effectively merged with The Answer Guy's stuff, short items being put
towards Two Cent Tips. With the advent of the Answer Gang, I actively
encourage people wherever I run into them - send in your good tips :)
The confusion seems to have arisen from my header on the 2c tips column
being too plain. sigh
Someone looking for the right submission address might (as I did) follow the
link from [81]http://linuxgazette.net to the Author FAQ, which says to mail
article submissions to [82]articles@linuxgazette.net and news items to
[83]bytes@linuxgazette.net. If we want the uninitiated to use the desired
submission address for 2 cent tips without having to ask here first, it
probably would be prudent to amend the Author FAQ, nicht wahr?
[Thomas] You might as well add it. No harm in doing so.
[Ben] It'll make it easier for authors who want to submit tips.
Anyway, this duplicates my June 18 post to "[84]articles@linuxgazette.net":
One feature of the GNU coreutils' "date" program that's indispensible in
creating date-stamped filenames: "date --iso-8601" returns the current
date in international date standard (ISO 8601) format. E.g., on June 17,
2005, "date --iso-8601" returns "2005-06-17".
Why is this so handy, you ask? First of all, ISO 8601 dates sort correctly
in ASCII- or alphabetical-ordered listings, unlike any number of other
popular date formats such as 06/17/2005 (United States), 17-JUN-2005
(NATO), or the Commonwealth format I grew up using (17/06/2005).
Second, like NATO format, it's unambiguous to people everywhere, a virtue I
would have appreciated when I switched from the British school system to the
USA's (and thus, suddenly, all written dates before the thirteenth of each
month were indeterminate).
I use the technique frequently when archiving file trees, as follows:
$ tar czf /tmp/etc-$(date --iso-8601).tar.gz /etc
It should be noted that ISO 8601's format has long been traditional in
Chinese culture. It's always good to have a quarter of humanity on one's
side for starters.
There are elaborations to the standard, that are somewhat less immediately
applicable to computing, e.g., time of day would be written in the obvious
24-hour hh:mm:ss or hhmmss formats. One can append a "Z" suffix if such
time-stamps are in zero-meridian ("Zulu", aka UTC) time. Otherwise, times
are impliedly local.
Unfortunately, the International Organisation for Standardisation (ISO) do
not have a freely downloadable copy of the ISO 8601 standard, but
independent authors Gary Houston, Steve Adams, and Jukka Korpela have
written pages that may be of interest to the more devoted calendar freaks
(including code snippets for some common programming languages):
* [85]http://hydracen.com/dx/iso8601.htm
* [86]http://www.saqqara.demon.co.uk/datefmt.htm
* [87]http://www.cs.tut.fi/~jkorpela/iso8601.html
____________________________________________________
=9= |