"source~/.bash_profile" displays "syntax error: unexpected end of file"

Asked 1 years ago, Updated 1 years ago, 47 views

As you can see in the title, when you run source~/.bash_profile on a Mac terminal, it says "syntax error: unexpected end of file".

However, if you show .bash_profile in vi, there are only 10 lines as shown below.

 if [-f to /.bashrc]; then
  . ~/.bashrc
fexport PATH=$HOME/.nodebrew/current/bin:$PATH
export PATH=$HOME/.nodebrew/current/bin:$PATH
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export PATH="/usr/local/opt/[email protected]/bin:$PATH"
export PATH="~/.rbenv/shims:/usr/local/bin:$PATH"
if which rbenv>/dev/null;then
event "$(rbenv init-)"
fi

I tried to change the position of the line as suggested on other sites as a solution, but it didn't work.
If anyone knows how to solve this problem, I would appreciate it if you could let me know.
Thank you for your cooperation.

bash

2022-09-30 19:43

1 Answers

It looks like it's on line 3

fiexport PATH=$HOME/.nodebrew/current/bin:$PATH

is

fi
export PATH=$HOME/.nodebrew/current/bin:$PATH

I think it will be


2022-09-30 19:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.