源 ~/.profile 中的错误

源 ~/.profile 中的错误
~/.profile (line 25): Missing end to balance this if statement
if [ -d "$HOME/local/bin" ] ; then
^
from sourcing file ~/.profile
    called on standard input

source: Error while reading file “/home/user/.profile”

答案1

根据报告的错误,您似乎正在将 Bourne 风格.profile引入fishshell:

$ fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
 ~> 
 ~> source ~/.profile
Missing end to balance this if statement
~/.profile (line 22): if [ -r "$HOME/env_vars" ]; then
                      ^
from sourcing file ~/.profile
    called on standard input

source: Error while reading file “/home/steeldriver/.profile”

两个 shell 系列之间的条件语法不兼容:例如参见fish 教程:条件语句 (If, Else, Switch)

相关内容