MacOS – Can’t get commands inside .bash_profile startup script to run

bashmacbook promacos

From my bash shell (latest version of Lion) if I issue the command…

source ~/sh/bashmarks.sh

The bashmarks.sh script will run and the functionality it provides is available. However I don't want to manually run this script so I have tried to put it into my ~/.bash_profile (the above command is the only thing in the file).

If I quit Terminal and then restart it, the ~/.bash_profile runs, but it reports…

: command not found

How can I get the commands contained in this script to run when the Terminal is opened? I know the correct .bash_profile is being run, because I can modify the file with some other commands and those don't work either, but the point being is I can see the output change when I modify the contents of the file and restart the shell. So it is picking up the right ~ user directory (I am the only account on the machine).

Best Answer

Does your .bash_profile have DOS-style line endings? Strange error messages like that often are "corrupted" by a \r character.