[CALUG] %d, %f, %s?

Etan S. C. Reisner deryni at unreliablesource.net
Fri Nov 21 12:41:23 EST 2008


On Sun, Nov 16, 2008 at 11:05:22PM -0500, John Cunningham wrote:
> I notice from creating desktop launchers in Gnome and Xfce that I can
> specify that a program work with a particular file by sticking "%f" at
> the end of the command.  I learned by trial and error that I can get
> it to work on a directory by using "%d".  In .mailcap I can tell a
> program to use data from stdin by sticking %s after the command.  What
> is this notation called, and where is it documented?
>
> Thanks,
>
> John

I'm unaware of any formal name for this sort of thing. I've seen them
called placeholders, specifiers, arguments, etc.

Unfortunately these sort of things are also very application/context
specific so documentation needs to be per-context.

Some examples:

The desktop launcher specification has a set (of which you found two).
http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html

The C function printf has a set of specifiers (man 3 printf).

Thunar (apparently) has the set shown in that dialog.

Pidgin (when not running in Windows) uses %s as the path to the sound file
when one is using the "Command" sound methog.

The find command has a set it uses for the -printf argument (man find and
search for "-printf format").


    -Etan




More information about the CALUG mailing list