Re: [dev] [st] Fixed -e with support for spaces

From: Moritz Wilhelmy <crap_AT_wzff.de>
Date: Sun, 28 Nov 2010 22:34:27 +0100

Excerpts from Joseph Xu's message of Sun Nov 28 22:20:21 +0100 2010:
> On 11/28/2010 06:22 AM, Aurélien Aptel wrote:
> > On Sat, Nov 27, 2010 at 12:35 AM, Joseph Xu <josephzxu_AT_gmail.com> wrote:
> >> came up with. It relies on the shell that executes st to parse the
> >> arguments, so you can't run a command like st -e "touch arst", you have
> >> to run st -e touch arst. This also means you can't have any st arguments
> >> after the -e because they'll all be included in the command to run.
> >
> > This breaks argument parsing. Why would you want to do that?
> > Josh's solution is better imo. I've pushed (a slight variation of) it to tip.
>
> Not sure what you mean by breaking argument parsing. I think it's the
> simplest way to parse a command with complex quoted arguments correctly
> without having to run an extra shell process.

I agree with you on that. Furthermore, both urxvt and xterm do it the same way.
From urxvt(1):

-e command [arguments]
    Run the command with its command-line arguments in the urxvt
    window; also sets the window title and icon name to be the
    basename of the program being executed if neither -title (-T) nor
    -n are given on the command line. If this option is used, it must
    be the last on the command-line. If there is no -e option then the
    default is to run the program specified by the SHELL environment
    variable or, failing that, sh(1).

    Please note that you must specify a program with arguments. If you
    want to run shell commands, you have to specify the shell, like
    this:

      urxvt -e sh -c "shell commands"

From xterm(1):

-e program [ arguments ... ]
        This option specifies the program (and its command line argu‐
        ments) to be run in the xterm window. It also sets the window
        title and icon name to be the basename of the program being
        executed if neither -T nor -n are given on the command line.
        This must be the last option on the command line.

I think it makes sense and people are used to it that way.

Best regards,

Moritz
Received on Sun Nov 28 2010 - 22:34:27 CET

This archive was generated by hypermail 2.2.0 : Sun Nov 28 2010 - 22:36:02 CET