On Tue, 2025-01-14 at 10:51 +0000, Geoff Clare via austin-group-l at
The Open Group wrote:
> I wonder whether perhaps Christoph was thinking that this wording:
> 
>     If any file descriptors with numbers greater than 2 are opened by
>     those redirections, it is unspecified whether those file
>     descriptors remain open when the shell invokes another utility.
> 
> means that in this part of the command substitution:
> 
>     command exec 2>&1 >&3 3>&-
> 
> "command" is "another utility" and so fd 3 could be closed when the
> shell executes "command", and thus it would not be open when
> "command"
> executes "exec", and the >&3 would fail.

`command exec` is anyway a special case:
Are the redirections those of command or those of exec?

>From how `command` is defined for special built-ins, I'd say it's
effectively as if the redirections were on `exec` (just without the
special properties of 2.15 Special Built-In Utilities).

And `exec` in turn is special to, since when no command name is given,
the redirections don't affect `exec` like another utility, but the
current shell execution environment.

So I was really mostly thinking about case like:
   command exec 3<file; ...  utility

my example was just bad, in that utility didn't use/see the > 2 FD.


Thanks,
Chris.

  • Re: exec red... Lawrence Velázquez via austin-group-l at The Open Group
    • Re: exe... Oğuz via austin-group-l at The Open Group
    • Re: exe... Chet Ramey via austin-group-l at The Open Group
      • Re:... Martijn Dekker via austin-group-l at The Open Group
        • ... Christoph Anton Mitterer via austin-group-l at The Open Group
          • ... Lawrence Velázquez via austin-group-l at The Open Group
  • Re: exec red... Lawrence Velázquez via austin-group-l at The Open Group
    • Re: exe... Geoff Clare via austin-group-l at The Open Group
      • Re:... Lawrence Velázquez via austin-group-l at The Open Group
        • ... Geoff Clare via austin-group-l at The Open Group
      • Re:... Christoph Anton Mitterer via austin-group-l at The Open Group
        • ... Geoff Clare via austin-group-l at The Open Group
    • Re: exe... Christoph Anton Mitterer via austin-group-l at The Open Group
  • Re: exec red... Harald van Dijk via austin-group-l at The Open Group
    • Re: exe... Christoph Anton Mitterer via austin-group-l at The Open Group
      • Re:... Oğuz via austin-group-l at The Open Group
    • Re: exe... Christoph Anton Mitterer via austin-group-l at The Open Group
      • Re:... Geoff Clare via austin-group-l at The Open Group
        • ... Geoff Clare via austin-group-l at The Open Group
        • ... Steffen Nurpmeso via austin-group-l at The Open Group
          • ... Steffen Nurpmeso via austin-group-l at The Open Group

Reply via email to