I am using mac and I have a script file print_hello
:
#!/bin/bash
echo hello
and if I run it directly from directory with ./print_hello
command and zsh terminal it will properly print hello. I would like to add it as a global command, so then writing print_hello
in terminal should print me "hello". but the thing I am getting is:
zsh: command not found: print_hello
The path is right ( I edited it in .zshrc
). The file has the proper permissions (I used chmod 755 print_hello
):
➜ ~ echo $PATH
/Users/mateusz/bin:/usr/local/bin:/Users/mateusz/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/GE/bin:~/scripts
and the print_hello
file is in ~/scripts
The only way I can run the script is directly from its directory. What should I do? I added some aliases in .zshrc
and they are working, so why are executable scripts are not working?
It is strange, but the thing that helped me was replacing
~/scripts
with
$HOME/scripts
in .zhrc file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With