[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to choose the shell?

From: Paul Smith
Subject: Re: How to choose the shell?
Date: Sun, 05 Sep 2021 15:18:18 -0400
User-agent: Evolution 3.36.5-0ubuntu1

On Sun, 2021-09-05 at 22:08 +0300, Eli Zaretskii wrote:
> First, how do you invoke the shell?  On Unix we do "$SHELL -c",
> right?  What to do on Windows?  Most Windows shells don't support "-
> c".
> Next, what are the characters special to the shell, and how to escape
> them?  We currently use Unix conventions for that, with some 
> Windows fixups, but that won't necessarily work with an arbitrary
> Windows shell.  What to use instead?

Sorry but I don't follow.  We don't invoke a shell at all: we invoke
the command in the SHELL variable.  We don't provide -c at all: we
provide the options in the .SHELLFLAGS variable.  We don't escape
anything at all: we provide the expansion of the command as the first

In other words, GNU make should basically run the equivalent of this
"pidgin code":

  argv = [$(SHELL)]
  argv += $(split $(.SHELLFLAGS))
  argv += ["<command>"]

It's up to the user to make sure the above construct actually works, if
they're not using a default SHELL.

This is why I raised the generalization of batch files as an issue:
some commands may not be able to accept "<command>" on the command line
like that, and if we could provide a _generic_ way to allow makefiles
to change that final argv value to something else like a reference to a
batch file where <command> was written, it could help.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]