TL;DR
A report on Disconnect3d’s blog explains that a tilde inside a quoted PATH assignment, such as “~/.local/bin”, may not expand to the home directory. The resulting path can refer to a literal directory named ~ in the current location; using $HOME avoids that ambiguity.
A warning from the nono sandboxing tool led programmer Disconnect3d to report that a quoted tilde in a shell PATH assignment may not refer to the user’s home directory. In a line such as export PATH="$PATH:~/.local/bin/", Bash and Zsh can retain the tilde as a literal character, potentially making commands run from a different directory than intended.
Get the latest gadgets delivered free with Prime
- Fast, free delivery on millions of items
- Prime Video, Amazon Music and more included
- Member-only deals all year
Disconnect3d said nono flagged ~/.local/bin/ as a PATH entry that the sandbox could write to. The warning prompted an investigation into how the path had been added. In the blog post, the author explains that tilde expansion generally occurs when the tilde is unquoted; quoting the full value prevents the shell from treating it as a home-directory shorthand in this example.
The suggested correction is export PATH="$PATH:$HOME/.local/bin/". The author says this explicitly inserts the path held in $HOME. They also note that an unquoted assignment such as export PATH=$PATH:~/.local/bin works in Bash and Zsh because those shells perform tilde expansion after an equals sign and after a colon in an assignment. The post cautions that this form is more fragile: whitespace can affect how the shell parses the assignment.
To demonstrate the effect, Disconnect3d created a directory literally named ~, placed a test executable under ./~/.local/bin/, and ran it with a PATH set to "~/.local/bin/". The shell found and executed the test program there. The example shows that a command can still work even when the path points to the current directory’s literal tilde-named folder, rather than to the user’s home.
How a PATH Entry Can Mislead
PATH determines where a shell looks for a command when a user enters its name. A mistaken entry can therefore make a command resolve from an unexpected location. In the reported example, that location is a literal directory named ~ relative to the current working directory, not ~/.local/bin under the home directory.
The practical risk depends on whether such a directory exists and what it contains. The blog’s sandbox warning concerned a path it identified as writable, but the post does not establish that a malicious file was present or that anyone was affected. For users who install personal command-line tools in ~/.local/bin, replacing the quoted tilde with $HOME makes the intended location explicit and avoids relying on subtle shell parsing rules.
Popular right now

Dyson Cyclone V10 Origin Cordless Vacuum

Sony 65 Inch BRAVIA 3 LED 4K HDR Smart Google TV (K-65S30)

Shark Pet Cordless Stick Vacuum, Up to 40-Minute Runtime, Lightweight, Ocean Blue, IX141
As an affiliate, we earn on qualifying purchases.
The Shell Expansion Behind the Warning
The report points to Bash’s documentation on tilde expansion. Bash recognizes certain unquoted tilde prefixes, including those appearing after a colon or the first equals sign in variable assignments. But that rule does not make a tilde inside a quoted string expand automatically. With PATH="$PATH:~/.local/bin/", the value is quoted, so the second path component can retain the tilde.
This distinction matters because shells parse command lines before using their values. The author’s example compares a quoted assignment with an unquoted one, and recommends the explicit $HOME form for shell startup files such as .bashrc, .zshrc or .profile. Disconnect3d credited nono with drawing attention to the issue and said the warning could provide more detail, adding that a pull request was planned.
““Instead of having /home/
/.local/bin/ added to PATH we end up with ./~/.local/bin/ added to PATH.”” — Disconnect3d, in the blog post
What the Warning Does Not Establish
The post documents a shell-parsing pitfall and a test case, but it does not report that the issue caused a compromise, exposed a real user’s account, or affected a particular software package. It also does not say how many people have PATH entries written this way. The risk in any specific setup depends on the exact PATH value, shell, startup-file contents, and whether a matching literal ~ directory exists.
The author’s discussion focuses on Bash and Zsh. The report does not provide a comparison across other shells or specify how every shell handles equivalent assignments. Its sandbox warning is an observation from the author’s setup, not evidence that every nono user will encounter the same warning.
Check Startup Files and PATH
Disconnect3d recommends checking PATH for a tilde and reviewing the shell startup files that set it. The post gives these commands: echo "$PATH" | grep -- '~' to search the full value, or echo "$PATH" | tr ':' '\n' | grep '~' to display matching entries individually. A match is a prompt to inspect the entry; it does not by itself prove that the path is being used incorrectly.
Users who find a quoted ~/.local/bin entry can replace the tilde with $HOME, then start a new shell or reload the relevant configuration and check the resulting PATH. Disconnect3d said a pull request to make nono’s warning more verbose was forthcoming. The post did not give a release date or confirm whether that change had been submitted or merged.
Key Questions
Does a tilde in PATH always expand to the home directory?
No. In the quoted assignment PATH="$PATH:~/.local/bin/", the tilde may remain literal rather than expanding to the home directory.
What should I use instead of a quoted tilde?
Use $HOME, as in export PATH="$PATH:$HOME/.local/bin/". This explicitly refers to the home-directory path stored in that environment variable.
How can I check whether my PATH contains a tilde?
Run echo "$PATH" | tr ':' '\n' | grep '~' to print entries containing a tilde. Then inspect the matching entry and the startup file that set it.
Does finding a tilde in PATH mean my system was compromised?
No. A matching entry indicates something to review, not proof of compromise. The blog post describes a possible path-resolution mistake and a demonstration, but reports no confirmed attack or affected users.
Source: hn
