Big Sur - Homebrew Install - illegal variable name
You need to install homebrew with this command:
/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;

Note: Use /bin/bash rather than /usr/bin/ruby.
The curl command inside the $() expression is executed and returns the content of the install.sh file. Then, the shell replaces the $() expression with these install instructions. As the install instructions are written for bash rather than ruby, bash is needed to execute them.
I could not reproduce the &quot;illegal variable name&quot; issue, however. Therefore, here are a couple of other workarounds that might help:
Option 1: Switch to bash or zsh
The &quot;illegal variable name&quot; could occur if you are not using bash or zsh as your terminal shell, but csh or tcsh instead. (You could find out using echo $0.)
Try switching to bash or zsh before executing the install command:
/bin/zsh
/bin/bash -c &quot;$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)&quot;

The first line starts a zsh shell. (You can also try /bin/bash instead, but I think, Big Sur uses zsh by default, now.) Then the second line is executed in this shell, which should circumvent the &quot;illegal variable name&quot; error.
The reason is that the bash and zsh shells might handle the $() expansion differently than csh and tcsh. If csh interprets everything after the $ as variable, it might consider $(... is an illegal variable name.
Option 2: Install from downloaded file
If, as mentioned in the comments, you have already downloaded the install.sh file, try executing the following in your terminal:
/bin/bash /path/to/install.sh

Here, /path/to/install.sh needs to be replaced by the actual path of the downloaded file. You could just type /bin/bash  and then drag-and-drop the file to your terminal, which should insert the path.