I'm using a mac for some years now and as I'm currently learning ruby on rails, I felt like I should learn more about the system I'm using. I took a look at the ~/.bash_profile, it looks like thisPATH=/Users/nikolajandersen/.apportable/SDK/bin:$PATH[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm # Load RVM$# Setting PATH for Python 3.3# The orginal version is saved in .bash_profile.pysavePATH=/Library/Frameworks/Python.framework/Versions/3.3/bin:${PATH}export PATHexport PATH=/usr/local/bin:$PATHexport PATH=/usr/local/bin:$PATHI'm completely new to this and tried to google my way though this but there are still some questions. The first one is: as there are two identical export PATH=/usr/local/bin:$PATH lines, I tried to delete the one. As a result, commands like nano and ls didn't work anymore. I reverted the change but I don't understand why it has to stated two times.Another question is: why does it sometimes $PATH and sometimes just PATH without the $?Why does -s $HOME/.rvm/scripts/rvm stand in [[ ]]braces? And what does export PATH do?Maybe someone could guide me to an easy to understand guide / tutorial / book where I could learn all this?Update This is the output of echo $PATH/usr/local/bin:/usr/local/bin:/Library/Frameworks/Python.framework/Versions/3.3/bin:/Users/nikolajandersen/.rvm/gems/ruby-2.0.0-p353/bin:/Users/nikolajandersen/.rvm/gems/ruby-2.0.0-p353@global/bin:/Users/nikolajandersen/.rvm/rubies/ruby-2.0.0-p353/bin:/Users/nikolajandersen/.rvm/bin:/Users/nikolajandersen/.apportable/SDK/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbinIt seems like you were right with the newline. I deleted the line again and made sure that there is a blank line in the end. Now the commands are still working.
Meaning of `export PATH=` in .bash_profile
bash;shell;path
The PATH before = is a variable name and the combination tells bash to store the stuff behind the = in the variable.The $PATH is the value of the variable PATH up until then.The combination PATH=some_path_to_stuff:$PATH extends the PATH variable. In bash this is a colon (:) separated list.Regarding the double addition of /usr/local/bin, I can only guess that the second version has no newline after it (and is at the end of the file). In principle this should give you a PATH which starts with /usr/local/bin:/usr/local/bin:..... You can check that with echo $PATHAnd if there is only one time /usr/local/bin then do:echo  >> ~/.bash_profileand login  an try to print $PATH again.