The shell reads syntax before it stores text
Disconnect3d found a warning from the nono sandbox about a writable ~/.local/bin/ entry in PATH. The configuration used export PATH="$PATH:~/.local/bin/". The quotes protected the whole value, so the tilde did not expand to the home directory.[1]
Bash documents the trigger in exact terms. Tilde expansion starts when a word begins with an unquoted tilde. Bash also checks unquoted tilde prefixes after the first equals sign and after colons in variable assignments.[2]
Quotes protect the string you wrote. They do not preserve the expansion you meant.
A literal tilde is a relative route
The stored entry ~/.local/bin does not begin with a slash. It can therefore point under the process's current working directory. Disconnect3d demonstrated the result by creating ./~/.local/bin/, placing an executable there, and running it through a literal-tilde PATH.[1]
This is more than a broken shortcut. If an untrusted project can create that relative directory and a process starts there, command lookup can reach the project's executable. The original post treats the result as a security concern, and nono surfaced it as a writable PATH entry. The exact exposure still depends on the working directory, process, permissions, and command order.
Use the expansion that works inside quotes
Write export PATH="$PATH:$HOME/.local/bin". The dollar sign keeps its parameter-expansion role inside double quotes. POSIX says double quotes preserve most characters but retain the special meaning of the dollar sign for parameter expansion.[3]
An unquoted assignment such as PATH=$PATH:~/.local/bin expands in Bash. The Bash manual supports that form.[2] It still asks a future edit to preserve shell-specific parsing. The explicit $HOME form says what should be stored and lets the quotes protect spaces in the expanded value.
Audit the value that programs inherit
Search the active value one entry at a time. The source post suggests echo "$PATH" | tr ':' '\n' | grep '~' as a quick check.[1] Use printf in scripts when you want predictable output. Then inspect the startup files that produced each match.
The customs bay below models the three assignments. It is a teaching fixture. It does not execute shell code or inspect your machine. Change the working directory to see why the literal route moves.