What I am trying to achieve
I added a custom location in the PATH variable hoping that I could run shell scripts placed in that location easily. But it is not working as I expected.
Here is what echo $PATH
returns
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$HOME/code/lab/pathcommands:/usr/local/go/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands
I have placed my script file named pause
in $HOME/code/lab/pathcommands
path. I was hoping I could just run pause
from the terminal and it would run the script file. But it returns
zsh: command not found: pause
If I place the same script file in /usr/local/bin
(which is also a part of $PATH variable), it works as expected.
What am I missing?
My OS - macOS Big Sur
Terminal - iTerm2
echo $PATH
returns the characters$HOME
and not the value of $HOME, then you've defined your path incorrectly. Show us how you modified your PATH. – Boogeyman$HOME/code/lab/pathcommands
at the end of/etc/paths
file. – Oleneolenka$HOME
with actual value. It started working. Thank you @glennjackman. – Oleneolenka