Syntax error from cshrc, but not showing line number


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Syntax error from cshrc, but not showing line number
# 8  
Old 05-22-2015
Hi.

I don't use gvim, but I use vim extensively. My .vimrc works in all shells that I have tried bash, ksh, tcsh, zsh, etc. I'm guessing that you are copying or creating the .vimrc lines with shell commands. Here is my .vimrc:
Code:
" .vimrc file
" $Id$
" Use vim to read this file, cat, etc., will
" not present an intelligible view.
"
syntax off
" set expandtab
set autoindent
set shiftwidth=4
set showmatch
set tabstop=4
set wrapmargin=15
map  i"ea"
map 
    !Gmy-spell

if has("autocmd")
  " When editing a file, always jump to the last known cursor position.
  " Don't do it when the position is invalid or when inside an event handler
  " (happens when dropping a file on gvim).
  autocmd BufReadPost *
  \ if line("'\"") > 0 && line("'\"") <= line("$") |
  \   exe "normal g`\"" |
  \ endif
endif " has("autocmd")

In the vim context, double quotes at the beginning of a line marks a comment.

We would need to know more about how you are creating and using .vimrc to help. I think the "set" error is because somehow tcsh is seeing the command, not vim, and set is how tcsh places values in variables.

Best wishes ... cheers, drl

Edit 1: In other words, exactly as neutronscott described.
This User Gave Thanks to drl For This Post:
# 9  
Old 05-22-2015
sea,
" can be used to comment in .gvimrc file. I have used the above posted code as such in ksh, as I've said earlier and it worked fine. And there are pages online which explains the same too. I didn't understand when you asked "Have you installed it?". If you are talking about gvim, it is already installed in the (company) server and I just needed to set path to point to the installation area, which I've done in .cshrc file.

neutronscott,
It is indeed an intialization file and is sourced from .cshrc or .profile file generally. I was running it from command line for debug purposes because I was getting syntax errors from the file. Otherwise it is automatically sourced. Thanks for the response though.
# 10  
Old 05-22-2015
No, it's generally loaded from within vim since the shell doesn't understand that language. Do you also run perl code from the command-line without invoking perl?

Code:
mute@tiny:~$ print qq=Did you say "Hello?"\n=;
Warning: unknown mime-type for "qq=Did" -- using "application/octet-stream"
Warning: unknown mime-type for "you" -- using "application/octet-stream"
Warning: unknown mime-type for "say" -- using "application/octet-stream"
Warning: unknown mime-type for "Hello?n=" -- using "application/octet-stream"
Error: no such file "qq=Did"
Error: no such file "you"
Error: no such file "say"
Error: no such file "Hello?n="
mute@tiny:~$ perl -e 'print qq=Did you say "Hello?"\n=;'
Did you say "Hello?"

See how perl code works in perl, but not in bash?

Same thing with your gvimrc initialization file. I promise.
This User Gave Thanks to neutronscott For This Post:
# 11  
Old 05-22-2015
Thanks neutronscott and drl!!

I had committed the blunder of trying to source .gvimrc from .cshrc. Actually I had copied it from one of my colleagues and somehow the code was there like that. Though I remember that gvimrc was never sourced from my previous kshrc, it somehow didn't dawn to me until I read your comments (even after neutronscott's first comment).

So bottom line "Never source rc files from another file. They are executed automatically". This applies to .kshrc/.cshrc etc too, I suppose.

Thanks sea, neutronscott, drl for the epiphany!! You guys are awesome.
# 12  
Old 05-22-2015
Well, you are welcome to source a .bashrc from bash to update your configuration without restarting a terminal or login session.

Just like I'm sure you can :source ~/.vimrc or the like from within Vim.

Just don't mix them up! Smilie
This User Gave Thanks to neutronscott For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Syntax error at line 24: `(' unexpected

Hi, I am getting an wired error.... the script is running fine when i run it manually... but the same when i try to run in nohup mode, i am getting error if Error: syntax error at line 24: `(' unexpected The above if is the 24th line!!! I dont understand the error... (4 Replies)
Discussion started by: Nithz
4 Replies

2. Shell Programming and Scripting

Receiving error: ./ang.ksh[35]: 0403-057 Syntax error at line 116 : `done' is not expected.

Hi All I am quite new to Unix. Following is a shell script that i have written and getting the subject mentioned error. #!/bin/ksh #------------------------------------------------------------------------- # File: ang_stdnld.ksh # # Desc: UNIX shell script to extract Store information.... (3 Replies)
Discussion started by: amitsinha
3 Replies

3. Shell Programming and Scripting

how to check which line of the script is showing the error

how to check which line of the script is showing the error... like -x will print each output in stdout... but want to know exact error line trowing error.. (2 Replies)
Discussion started by: mail2sant
2 Replies

4. Shell Programming and Scripting

ERROR: ./launch_full_backup.sh[18]: Syntax error at line 28 : `else' is not expected.

Help please! :confused: I have the following error with the following file and the emails are not arriving to the email, any idea please? ERROR: ./launch_full_backup.sh: Syntax error at line 28 : `else' is not expected. FECHA=`date +%d%m%y%H%M`... (2 Replies)
Discussion started by: villenan
2 Replies

5. Shell Programming and Scripting

Syntax error at line 11 : `for' is not matched.

hi , while running this script i am getting below error: Syntax error at line 11 : `for' is not matched. here is program: #! /bin/ksh sqlplus -s << !+! user/password update GR_SUB_SCRIPT_PC set act_del_ind='0'; commit; exit; !+! cd /home/salunke/pvcsfiles/source_files for i in... (5 Replies)
Discussion started by: digambar
5 Replies

6. UNIX for Dummies Questions & Answers

syntax error at line 8: `(' unexpected

Hi I am having a shell script load_data.sh which calls /home/users/project/.profile. When am executing the script, am getting below error: $sh -x bin/load_data.sh null + . /home/users/project/.profile bin/load_data.sh: syntax error at line 8: `(' unexpected The line which is throwing... (1 Reply)
Discussion started by: brijesh.dixit
1 Replies

7. Shell Programming and Scripting

syntax error at line 28: `(' unexpected

hi can anyone pls look into this....shell script... Pls find the error below: > sh -n tmp tmp: syntax error at line 28: `(' unexpected isql -Usa -S$1 -P`grep $1 dbpassword|cut -d ":" -f3` -w2000 -b<<! set nocount on declare @i int declare @dbname char(6) declare @tmp int if... (10 Replies)
Discussion started by: rajashekar.y
10 Replies

8. Solaris

./runInstaller : syntax error at line 2

Hi all, I've a problem with oracle10.1.0.2 installation on Solaris 10 (I already know this is possible) but when I run "./runInstaller" command from CD I read "syntax error at line 2" followed by several lines (ex. \200\201\203\206...ect). Can you help me please? It is very urgent! (19 Replies)
Discussion started by: Sunb3
19 Replies

9. Programming

sh: syntax error at line 1: `>' unexpected

I compiled C program under SUN OS sparcv9 ...I had a problem related to SIGBUS which has been resolved by adding an option to the CC compiler which is memory alignement option ..-memalign=1i as I remmber ...after running the program I got the below error please let me KNow more details what should... (2 Replies)
Discussion started by: atiato
2 Replies

10. Shell Programming and Scripting

syntax error on line 1, teletype

Hi There, I have a cron script that returns the error: syntax error on line 1, teletype Has any one seen this, know what it is, or know's how to get rid of it? Thanks, Jeremy. (1 Reply)
Discussion started by: KokoPops
1 Replies
Login or Register to Ask a Question