user1574598
user1574598

Reputation: 3879

Command Line OSX: Configuring the PATH variable

I've tried to set up a folder called bin in my user directory. Sadly, my first attempt of appending the new directory was incorrect as I missed a ". I tried opening up the .bash_profile to try and delete my first attempt, but due to not really knowing what I was doing when saving I get these errors when I open the bash.

Last login: Mon Dec 23 11:13:39 on ttys000
-bash: /Users/daz/.bash_profile: line 2: unexpected EOF while looking for matching `"'
-bash: /Users/daz/.bash_profile: line 3: syntax error: unexpected end of file
darryls-mini:~ daz$ cat ~/.bash_profile
PATH=$PATH:~/bin"
PATH="$PATH:~/bin"
darryls-mini:~ daz$ 

The first line after cat is the incorrect one. This is the result of me trying to delete the bash_profile file and re-saving it using pico ~/.bash_profile

Upvotes: 0

Views: 948

Answers (3)

ales_t
ales_t

Reputation: 2017

Why don't you just edit the file and delete the line? Alternatively, this command will do it for you (assuming that your ~/.bash_profile is otherwise empty, as it seems to be in your post):

echo 'PATH="$PATH:~/bin"' > ~/.bash_profile

Upvotes: 1

Matteo
Matteo

Reputation: 14940

The error message is telling you what the problem is:

unexpected EOF while looking for matching `"'

You close the quotes without opening them:

PATH=$PATH:~/bin"

Change it to

PATH=$PATH:~/bin

or

PATH="$PATH:~/bin"

Upvotes: 1

devnull
devnull

Reputation: 123608

The error is in the following:

PATH=$PATH:~/bin"

which is causing the unexpected EOF while looking for matching `"'.

Observe the quoting. You probably wanted to say:

PATH="$PATH:~/bin"

Upvotes: 2

Related Questions