[MPlayer-dev-eng] run command patch

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Feb 15 20:31:09 CET 2012


On Wed, Feb 15, 2012 at 08:16:52PM +0100, Jan Christoph Uhde wrote:
> On 2012-02-15 19:28, Reimar Döffinger wrote:
> > 
> > 
> > On 15 Feb 2012, at 19:16, Jan Christoph Uhde <Jan at UhdeJc.com> wrote:
> > 
> >> On 2012-02-14 21:49, compn wrote:
> >>
> >>>>
> >>>> It should work with any shell that supports "echo" and ">>",
> >>>> I think that includes even Windows cmd.exe, so yes, I
> >>>
> >>> except for "~/interesting" not working in cmd.exe.
> >>> echo and >> do work on cmd.exe.
> >>>
> >>> you could just add another line how to do it on windows if anyone cares
> >>> about it.
> >>
> >> people who read this file will know how ~ expands on *nix and that they
> >> must use %USER%, %HOME% or whar ever on windows:)
> > 
> > Well, you could just leave the path out and it should work fine anywhere, even if it is slightly less useful as-is.
> > Though I think the command tries to run sh anyway, so I think that feature does not work at all on Windows currently.
> > At the same time, /bin/sh is almost certainly a POSIX shell, so the command should indeed always work.
> > But either way the main point was that it was completely unclear what that sentence was supposed to mean, and we definitely shouldn't have that in the documentation.
> 
> Hopefully you understand now better what i was trying to say:)

> Index: DOCS/tech/slave.txt
> ===================================================================
> --- DOCS/tech/slave.txt	(revision 34728)
> +++ DOCS/tech/slave.txt	(working copy)
> @@ -508,11 +508,21 @@
>      Hides the OSD menu console. Clicking a menu command unhides it. Other
>      keybindings act as usual.
>  
> -run <value>
> -    Run <value> as shell command. In OSD menu console mode stdout and stdin
> -    are through the video output driver.
> +run <string>
> +    Run <string> with expanded variables as shell command. In OSD menu
> +    console mode stdout and stdin are through the video output driver.
>  
> +    Example:
> +    <KEY> run "echo '${filename} ${stream_pos}' >> <path_to_file>"
>  
> +    A POSIX shell would not be able to expand the variables between
> +    single quotes. So it should be obvious that ${<var_name>} strings are
> +    not shell variables. The syntax with curly braces for shell variables
> +    can not be used. Because the variable is either expanded to one
> +    of MPlayer's properties or a string of length zero before the
> +    command is passed to /bin/sh.

Ah.
Maybe more clear:
Note: MPlayer will do variable expansion on anything of the form
${somevar} before it is passed to the shell.
This means that you cannot use this syntax for anything you actually
want the shell to handle.
Anything else will be passed on to the shell unchanged, so you can
use e.g. $somevar to have the shell expand it instead of MPlayer.


More information about the MPlayer-dev-eng mailing list