The syntax error may related to the CRLF and CR problem, you may resolve this by edit the file in linux side or using a rich editor such as notepad++ which you can save using Linux newline, refer to this post
Beside, you may want to write those scripts in .bashrc
The bash man page on my linux box says:
FILES
/bin/bash
The bash executable
/etc/profile
The systemwide initialization file, executed for login shells
~/.bash_profile
The personal initialization file, executed for login shells
~/.bashrc
The individual per-interactive-shell startup file
~/.bash_logout
The individual login shell cleanup file, executed when a login
shell exits
~/.inputrc
Individual readline initialization file
/etc/inputrc
System readline initialization file
according to this post, the terminal.app on OS X is an exception.
Mac OS X — an exception
An exception to the terminal window guidelines is Mac OS X’s
Terminal.app, which runs a login shell by default for each new
terminal window, calling .bash_profile instead of .bashrc. Other
tGUI terminal emulators may do the same, but most tend not to.