[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: funsub questions
From: |
Greg Wooledge |
Subject: |
Re: funsub questions |
Date: |
Wed, 13 Dec 2023 21:43:27 -0500 |
On Thu, Dec 14, 2023 at 02:39:04AM +0000, Kerin Millar wrote:
> On Wed, 13 Dec 2023 21:17:05 -0500
> Greg Wooledge <greg@wooledge.org> wrote:
>
> > On Wed, Dec 13, 2023 at 08:50:48PM -0500, Zachary Santer wrote:
> > > Would there be a purpose in implementing ${< *file*; } to be the
> > > equivalent
> > > of $(< *file* )? Does $(< *file* ) itself actually fork a subshell?
> >
> > $(< file) does indeed fork. The only difference between $(< file) and
> > $(cat file) is the latter also does an exec (but it's portable).
>
> This stopped being the case with the release of 5.2 or thereabouts.
unicorn:~$ strace -e clone bash-5.1 -c ': $(< /etc/profile)'
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x7f274f5cba10) = 105452
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=105452, si_uid=1000,
si_status=0, si_utime=0, si_stime=0} ---
+++ exited with 0 +++
unicorn:~$ strace -e clone bash-5.2 -c ': $(< /etc/profile)'
+++ exited with 0 +++
Huh... so it seems. OK then.
Re: funsub questions, Andreas Schwab, 2023/12/14
Re: funsub questions, Kerin Millar, 2023/12/13