kibowki
kibowki

Reputation: 4376

"command not found" in ZSH script

I'm trying to run this script by typing ~/scripts/recomposeUi.zsh but am receiving the following error when doing so:

/Users/me/scripts/recomposeUi.zsh:2: command not found: dcrs

Here is my script, recomposeUi.zsh:

#!/bin/zsh
cd ~/myProject/ && npm run build && docker build -t wm . && cd ~/projectTwo/ && dcrs && cd ~/myProject/

Here is my .zshrc:

alias dcd='docker-compose down'
alias dcu='docker-compose up -d'
alias dcp='docker-compose pull'
alias dcrs='dcd && dcp; dcu'

What is going wrong?

Upvotes: 1

Views: 1810

Answers (1)

Bor Laze
Bor Laze

Reputation: 2516

.zshrc is executed in interactive shell.

Shell for script isn't interactive.

Try to move your aliases to .zshenv (executed always) or add to head of your script command source ~/.zshrc (manually read)

Upvotes: 3

Related Questions