O script é executado usando /bin/zsh , que não é um shell interativo ou de login e não carrega esse arquivo. De man zsh , ênfase minha:
Commands are first read from /etc/zshenv; this cannot be overridden. Subsequent behaviour is modified by the RCS and GLOBAL_RCS options; the former affects all startup files, while the second only affects global startup files (those shown here with an path starting with a /). If one of the options is unset at any point, any subsequent startup file(s) of the corresponding type will not be read. It is also possible for a file in $ZDOTDIR to re-enable GLOBAL_RCS. Both RCS and GLOBAL_RCS are set by default.
Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zprofile and then $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands are read from /etc/zshrc and then $ZDOTDIR/.zshrc. Finally, if the shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read.
O script herda o ambiente de onde é chamado e, se este não for outro shell (interativo), ele não conterá as preferências definidas em .zshrc .
Você pode definir o PATH onde ele se aplica globalmente (por exemplo, /etc/zshenv ), defini-lo explicitamente no script ou alterar o cabeçalho do script shebang para executar /bin/zsh -i , fazendo com que ele carregue .zshrc (citando man zsh : Força o shell a ser interativo. Ainda é possível especificar um script para executar. ).
Como alternativa, basta especificar o caminho completo para o programa que não está no padrão PATH , por exemplo, /home/pc/less.js/bin/lessc .