error while running "source .vimrc"

i am having a simple vimrc file when i run "source .vimrc" in ubuntu I am getting the following error.

$ source .vimrc 
bash: .vimrc: line 3: syntax error near unexpected token `"syntax"'
bash: .vimrc: line 3: `if has("syntax")'

Here is my script file

set term=builtin_ansi
set nu
if has("syntax")
    syntax on
endif

I do have syntax installed in my vim.

vim --version | grep syntax
vim: /home/shankaran/src/ns/service/build/dp/lib/libcrypto.so.1.0.0: no version information available (required by /usr/lib/libpython2.7.so.1.0)
vim: /home/shankaran/src/ns/service/build/dp/lib/libssl.so.1.0.0: no version information available (required by /usr/lib/libpython2.7.so.1.0)
-sniff +startuptime +statusline -sun_workshop +syntax +tag_binary 

Solution 1:

You tried to source your Vim configuration file from bash. Do it from Vim:

$ vim
:source /path/to/.vimrc

If it's located at ~/.vimrc, Vim will source that file automatically.