[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Add shell-quasiquote.
From: |
David Kastrup |
Subject: |
Re: [PATCH] Add shell-quasiquote. |
Date: |
Wed, 21 Oct 2015 20:11:38 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
>> From: Random832 <address@hidden>
>> Date: Wed, 21 Oct 2015 13:06:46 -0400
>>
>> Eli Zaretskii <address@hidden> writes:
>> >> From: Random832 <address@hidden>
>> >> It doesn't have a documented way for the caller to insist that the
>> >> string be quoted for a POSIX shell rather than the user's shell.
>> >
>> > On what OS would that distinction be important, and why?
>>
>> Any OS which may have both a POSIX shell that a script may want to
>> execute and a non-POSIX shell that is the user's shell. So basically all
>> of them, especially if support for more non-POSIX shells such as csh,
>> rc, scsh, fish, tclsh, is added in the future - or if a user's
>> configuration supports them in the present by replacing or advising the
>> function.
>
> First, do csh and the rest really non-Posix? I wonder. I always
> understood "Posix shells" as a short for "any shell on a Posix host".
I think it's more like "any shell trying to obey an (ex-)POSIX
standard". Which would be
<URL:http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html>
and would not cover a csh. Users may set a different login and/or
interactive shell. That's strictly speaking no longer "POSIX" if it
does not try to be Bourne shell compatible in the main regards.
> Is that incorrect? In what way are those "non-Posix"?
Not trying to meet an (ex-)POSIX standard I think.
>> It would mainly be useful in the presence of a broader mechanism,
>> which doesn't exist yet, for executing POSIX shell scripts regardless
>> of the user's interactive shell.
>
> On Posix hosts? I thought that was automatic, since each script says
> what interpreter should run it in its "shebang" line. Right?
Not necessarily. You can leave off the shebang line and scripts will be
directly called by a fork (or something programmed to be equivalent) of
your shell which might be more efficient than going through shebang. To
avoid a csh executing a Bourne-only script, you can place a single : in
the first line. That's a noop for a Bourne shell, and it tells csh and
its ilk that it should not even try interpreting that script itself but
rather leave that to /bin/sh or similar.
These days, there are very few shell scripts _not_ started with a
shebang line. But it's a definite possibility, even though then calling
such scripts _not_ from a shell command line might fail. According to
the man pages for GNU/Linux I have here, system(3) uses /bin/sh and
should likely work whereas execve(2) requires the shebang line in order
to pick an interpreter rather than loading a binary.
Haven't tried this for a long time.
--
David Kastrup
- Re: [PATCH] Add shell-quasiquote., (continued)
- Re: [PATCH] Add shell-quasiquote., Wolfgang Jenkner, 2015/10/22
- Re: [PATCH] Add shell-quasiquote., Eli Zaretskii, 2015/10/22
- Re: [PATCH] Add shell-quasiquote., David Kastrup, 2015/10/22
- Re: [PATCH] Add shell-quasiquote., Paul Eggert, 2015/10/22
- Re: [PATCH] Add shell-quasiquote., Eli Zaretskii, 2015/10/22
- Re: [PATCH] Add shell-quasiquote., Wolfgang Jenkner, 2015/10/22
- Re: [PATCH] Add shell-quasiquote.,
David Kastrup <=
- Re: [PATCH] Add shell-quasiquote., Random832, 2015/10/21
- Re: [PATCH] Add shell-quasiquote., Eli Zaretskii, 2015/10/21
- Re: [PATCH] Add shell-quasiquote., Random832, 2015/10/21
- Re: [PATCH] Add shell-quasiquote., Eli Zaretskii, 2015/10/21
- Re: [PATCH] Add shell-quasiquote., Random832, 2015/10/21
- Re: [PATCH] Add shell-quasiquote., Eli Zaretskii, 2015/10/21
- Re: [PATCH] Add shell-quasiquote., David Kastrup, 2015/10/22
- Re: [PATCH] Add shell-quasiquote., Random832, 2015/10/22
- Re: [PATCH] Add shell-quasiquote., David Kastrup, 2015/10/22
- Re: [PATCH] Add shell-quasiquote., Random832, 2015/10/22