Unverified50% confidenceFactExact time
The root cause of ~ sometimes working and sometimes failing in PATH is that it can only be expanded when some intermediate link happens to invoke the shell to handle it.
1
Sources
50%
Confidence
Long-term
Relevance
10/12/2026
First Seen
Sources
Related Entities
Related Claims
UnverifiedThe contents of the PATH environment variable, when read by a system call (such as execvp), do not go through the shell's expansion process, so a ~ in PATH is treated as an ordinary character-based directory.71% similarUnverifiedShell glob expansion is completed before command execution, so programs like sed see the expanded real paths rather than the original strings containing wildcards.70% similarUnverifiedEnvironment variable assignments (such as $env:FOO=bar or export FOO=bar) are only effective in the current Shell process and its child processes, and become invalid when the terminal is closed; to take effect permanently, they need to be written into the Shell startup script (such as .bashrc, .zshrc, $PROFILE) or system environment variables.67% similarUnverifiedIf typing gemini results in a "command not found" prompt, the most likely cause is that the global installation path has not been added to the system environment variable PATH, which can be resolved by restarting the terminal or confirming that the npm global bin directory is in PATH.66% similarUnverifiedInvocation paths that do not go through the shell (such as directly using execvp, posix_spawn, or the process-launching functions implemented in many languages' standard libraries) do not trigger tilde expansion, because they do not parse shell syntax.65% similar
Cite This Claim
Stable URI
https://kongchang.com/claim/1012613API
curl https://kongchang.com/api/v1/knowledge/claims/1012613MCP
get_claim(id=1012613)