[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: should this result in an endless loop ?
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: should this result in an endless loop ? |
Date: |
Sun, 28 Nov 2021 07:13:51 +0100 |
On Sat, Nov 27, 2021, 20:30 Lawrence Velázquez <vq@larryv.me> wrote:
> Please stop randomly switching email addresses within your own
> threads.
>
sorry i have the list subscribed twice, i couldnt answer my first email
with the comment cause it didnt appear
> On Sat, Nov 27, 2021, 20:06 Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
> wrote:
> >
> >> in the progress to represent another bug report about something, i made
> >> this nonfunctional code
> >>
> >> printf '(( $# )) && . afile' >afile
> >>
> >> i run it with . afile a or bash afile a
> >> then it ends up never ending
> >> in set -x theres like dozens of '+' deep doing the code
>
> A demonstration for the curious:
>
> % cat >afile <<\EOF
> heredoc> (( $# )) && . afile
> heredoc> EOF
> % bash -x afile a
> + (( 1 ))
> + . afile
> ++ (( 1 ))
> ++ . afile
> +++ (( 1 ))
> +++ . afile
> ++++ (( 1 ))
> ++++ . afile
> +++++ (( 1 ))
> +++++ . afile
> [...]
>
> On Sat, Nov 27, 2021, at 2:08 PM, ikhxcsz7y xmbott wrote:
> > maybe the '. file' didnt apply 'noargs given'
>
> Yes, when you run ''. afile'' without arguments, the positional
> arguments are not cleared. The manual states this explicitly.
>
i see, didnt know, thanks
>
> . filename [arguments]
>
> Read and execute commands from the `filename` argument in the
> current shell context. [...] If any `arguments` are supplied,
> they become the positional parameters when `filename` is
> executed. Otherwise the positional parameters are unchanged.
>
>
> https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html#index-_002e
>
> --
> vq
>
>