Please stop randomly switching email addresses within your own
threads.
> 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.
. 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