环境
- brew had installed
- brew environment setting as [official site](https://docs.brew.sh/Homebrew-on-Linux)
- php had installed with brew
- composer had installed with brew
目标
我想使用PHP与"php“命令,该命令brew已经安装,但失败。
我所做的一切
- Following success in current shell but fail when restart shell在bash中,我尝试了这些PATH=${ PATH }:/home/linuxbrew/.linuxbrew/bin/ export PATH=${ PATH }:/home/linuxbrew/.linuxbrew/bin/ #,我尝试了以下设置路径:$PATH /home/linuxbrew/.linuxbrew/bin/ -update:更新后的导出路径$PATH:/home/linuxbrew/.linuxbrew/bin/ bin/ <-update:错误
- Following success in bash but fail in fish
- add the command above in .bashrc file in user directory (.bashrc seems only run when bash)
- Following should success but fail
- `sudo -H vi /etc/environment`
- add `/home/linuxbrew/.linuxbrew/bin/` in it
发布于 2020-03-21 12:07:29
如果您希望在启动fish时运行命令,则需要将它们放入~/..config/config.fish/中的一个名为"config.fish“的文件中。顾名思义,Bashrc是bash特有的。
此外,"export“用于标记”导出“变量,这意味着将其传递给shell启动的外部命令。$PATH通常是从启动shell的任何东西继承的,这意味着它无论如何都是导出的,所以您的export行是无用的。
另外,您的fish命令需要稍加调整:
set PATH $PATH /home/linuxbrew/.linuxbrew/bin/$PATH在fish中是一个列表,因此它需要设置为多个参数,而不是一个字符串。在fish 3.0中(在Ubuntu18.04之后发布),它被调整为自动拆分为":",但即使在这种情况下,您也必须引用它,否则它将有令人惊讶的结果。
https://stackoverflow.com/questions/60787436
复制相似问题