-1

Whenever I open my bash profile I am immediately greeted with:

Last login: Wed Jul 27 11:41:49 on ttys000
-bash: PATH: command not found
-bash: export: `“/Users/allisondavis/Documents/HCl/sfit4/pbin/Layer0:/Users/allisondavis/Documents/HCl/sfit4/pbin/Layer1:/Users/allisondavis/Documents/HCl/sfit4/pbin/ModLib:/Users/allisondavis/Documents/HCl/Pythonstuff”': not a valid identifier
~.bash_profile

Here is my bash profile:

PATH="~/bin:/usr/bin:${PATH}"
export PATH
PATH = “/Users/allisondavis/Documents/HCl/sfit-ckopus”
export PATH
export PATH PYTHONPATH= “/Users/allisondavis/Documents/HCl/sfit4/pbin/Layer0:/Users/allisondavis/Documents/HCl/sfit4/pbin/Layer1:/Users/allisondavis/Documents/HCl/sfit4/pbin/ModLib:/Users/allisondavis/Documents/HCl/Pythonstuff”
export PYTHONPATH

PATH=${PATH}:${PYTHONPATH}
export PATH


echo '~.bash_profile'
# Setting PATH for Python 3.5
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}"
export PATH

Any idea what the problem is?

alli
  • 105
  • 3
  • 13

2 Answers2

1

Below line is not correct

PATH = “/Users/allisondavis/Documents/HCl/sfit-ckopus”

It should be something like this:

PATH="$PATH:/Users/allisondavis/Documents/HCl/sfit-ckopus"
  1. remove the spaces around =
  2. replace your double quotes to "
  3. you cannot replace PATH to /Users/allisondavis/Documents/HCl/sfit-ckopus, you need to append it to your PATH

Here's a bash profile sample online, you can read it and modify your own profile Mac OS bash profile sample

Haifeng Zhang
  • 30,077
  • 19
  • 81
  • 125
  • how to you go between the types of quotes? – alli Jul 27 '16 at 20:14
  • @alli I have 2 text inputs: English and Chinese. Switch to English input when modify profile – Haifeng Zhang Jul 27 '16 at 20:15
  • @alli, `""` are the only quotes any proper UNIX text editor will insert. If you avoid using programs that aren't meant to act as text editors for editing text, you won't see any other kind. – Charles Duffy Jul 27 '16 at 20:19
  • I went to system preferences and mine says it only has U.S. English... – alli Jul 27 '16 at 20:20
  • What program are you actually using to edit this file? Emacs? vim? gedit? ...? -- this is the kind of bug you would get if you were using Microsoft Word (or pasting from the clipboard content originally written by someone who did). – Charles Duffy Jul 27 '16 at 20:26
1

You have a couple problems there. The one giving you the error there is the quotes you're using: “foo” should be "foo".

Your next issue is that you'll be losing your original path through the options there. You probably want something like:

PATH="$HOME/bin:/usr/bin:${PATH}";
PATH="/Users/allisondavis/Documents/HCl/sfit-ckopus:${PATH}";
PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}";
export PATH;

PYTHONPATH="/Users/allisondavis/Documents/HCl/sfit4/pbin/Layer0:/Users/allisondavis/Documents/HCl/sfit4/pbin/Layer1:/Users/allisondavis/Documents/HCl/sfit4/pbin/ModLib:/Users/allisondavis/Documents/HCl/Pythonstuff:${PYTHONPATH}";
export PYTHONPATH;

You also cannot use ~ to refer to home when assigning PATH, instead you should be using $HOME.

  • do you know how to go between the different types of quotes? – alli Jul 27 '16 at 20:16
  • Also, `~` cannot be quoted in the assignments. – chepner Jul 27 '16 at 20:19
  • @chepner You are 100% right there. I noted it at first, but forgot to change it when copying and pasting from the OP. Updated answer. – Nicholas Anderson Jul 27 '16 at 20:21
  • @alli, This was asked in a comment on the question, but what are you using to edit the files? Any kind of rich text editor will default to the styled quotes. – Nicholas Anderson Jul 27 '16 at 20:24
  • 1
    Just for completeness, you can still use `~` as long as it isn't quoted; the shell expands it if it is the first unquoted character following the `=` or an assignment or following a `:` in the value of an assignment. – chepner Jul 27 '16 at 20:25
  • btw, `export` is only needed for variables that aren't *already* flagged for export. `PATH` is already going to be in the environment before your `.bashrc` is run, so updates to it will be reflected in the environment already. – Charles Duffy Jul 27 '16 at 20:28
  • I finally used nano to edit the bash instead of a text editor and it worked after a few tries, however I did not implement the $HOME and it is no longer giving me the error - I will try this for completeness – alli Jul 27 '16 at 20:45