Search code examples
bashshellpathzsh

ZSH command not found, even if command is in my $PATH


So I have a script called kc which compiles Kotlin files into a jar.

The file is located at ~/Documents/KotlinPlayground/bin and my $PATH looks like this:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/Documents/KotlinPlayground/bin:~/Library/Android/sdk/platform-tools/

when I just type kc SomeFilt.kt into the command line I get a zsh: command not found: kc, but if I type in ~/Documents/KotlinPlayground/bin/kc SomeFile.kt it works.

So how come zsh can't find my script even though its in the path?


Here is an image showing the problem:

enter image description here


I also tried adding #!/bin/bash to the top of kc and continued getting the same issue


Solution

  • I think the problem is that zsh is not interpreting ~/ correctly. You could replace ~/Documents to /home/user/Documents to solve the problem.