简体   繁体   English

ZSH脚本中的“找不到命令”

[英]“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: 我正在尝试通过键入~/scripts/recomposeUi.zsh来运行此脚本,但这样做时会收到以下错误:

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

Here is my script, recomposeUi.zsh: 这是我的脚本recomposeUi.zsh:

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

Here is my .zshrc: 这是我的.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? 怎么了?

.zshrc is executed in interactive shell. .zshrc在交互式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) 尝试将别名移动到.zshenv (始终执行)或添加到脚本命令source ~/.zshrc .zshenv开头(手动阅读)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM