[Top][All Lists]

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

Re: ignoring current shell and always running posix shell? Re: Should th

From: Pierre Gaston
Subject: Re: ignoring current shell and always running posix shell? Re: Should this be this way?
Date: Mon, 11 Mar 2013 19:24:17 +0200

On Mon, Mar 11, 2013 at 7:11 PM, Linda Walsh <address@hidden> wrote:
> Pierre Gaston wrote:
>> On Tue, Feb 26, 2013 at 11:22 AM, Roman Rakus <address@hidden> wrote:
>>> I think the line above will produce unspecified behavior.
>> Man bash says:
>> If  this  execution  fails because the file is not in executable
>> format, and the file is not a directory, it is assumed to be a shell
>> script, a file containing shell commands.  A subshell is spawned to
>> execute it.  This subshell reinitializes itself, so that the effect is
>> as  if  a  new  shell  had  been  invoked  to  handle  the script,
>> with the exception that the locations of commands remembered by the
>> parent (see hash below under SHELL BUILTIN COMMANDS) are retained by
>> the child.
> ----
>         I doubt that starting a different shell than the one you are
> running under is going to preserve commands in the same way as the parent
> UNLESS the parent is the same shell.

Correct, that's why bash doesn't do that (at least an upstream not
patched version that the manual is documented)

>         Has passing such hashed args been standardized between zsh/tcsh,ksh
> /sh/bash?

I don't know

>> SUS says
>> If the execve() function fails due to an error equivalent to the
>> [ENOEXEC] error defined in the System Interfaces volume of
>> POSIX.1-2008, the shell shall execute a command equivalent to having a
>> shell invoked with the pathname resulting from the search as its first
>> operand, with any remaining arguments passed to the new shell, except
>> that the value of "$0" in the new shell may be set to the command
>> name. If the executable file is not a text file, the shell may bypass
>> this command execution. In this case, it shall write an error message,
>> and shall return an exit status of 126.
> ----
>         It is likely that the document is assuming you are running on
> a POSIX compliant system where all users use the same shell so there is
> only 1 shell, thus the use of the word 'the' when referring to the shell.
Of course, it's the posix specification for the posix shell........

reply via email to

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