Scripts that are executed for a login shell (systemwide /etc/profile, any script in /etc/profile.d, your local ~/.profile and the other files you list) define the environment of your current user - since you logged in.
Any non-login shell that you subsequently open, will at least inherit the environment of your login shell. That is why you (already) have ...
The other answers here are pretty good. But I sould like to add that the $ is also commonly called "string" as it is often asociated with a string.
Also, I have heard ! called "bang" and * called "splat".
In addition, I have heard ^ called "carrot".
There are a few comments worth noting.
"... the gpg passphrase (which is set by a script)". I take it you didn't write the script. Please post the script. Are there any instructions to use it?
passphrase="my!pass". This doesn't mean "use ! as part of the string". !pass means "read history, and get the last command starting ...
The nohup Wikipedia Page has a reference to this issue specifically:
Note that nohupping backgrounded jobs is typically used to avoid terminating them when logging off from a remote SSH session. A different issue that often arises in this situation is that ssh is refusing to log off ("hangs"), since it refuses to lose any data from/to the ...
There is no need to specify the directory when using the WordPress CLI. Instead you go to the directory where the core is to be copied:
sudo -u www-data wp core download
Using sudo -u www-data ensures the files are copied with the correct ownership.
From there, you can begin your WordPress installation.