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
# 1  
Old 05-22-2015
Syntax error from cshrc, but not showing line number

Hi,

I have been using ksh till now but was forced to use tcsh from last few days. I am getting a gvimrc error which says "set: Syntax error". What makes this pesky is that it is not showing which line number is the error from. How do I get the line number of the error?

Also, I am using the same gvimrc as I used in ksh, where comments were done using double quotes ("). But here all those are not taken as comments. So I want to know whether only # can be used to comment lines in tcsh ?
# 2  
Old 05-22-2015
Hi, welcome to the forums.

You probably have a quotation errror/typo near a place you set a variable.
Try:
Code:
$SHELL -x ./scriptname

To get an idea at what place it stops executing code.

If you need more detailed help, please provide the script in code tags.

Hope this helps

EDIT:
No, # work as comments in all shells
This User Gave Thanks to sea For This Post:
# 3  
Old 05-22-2015
Hi Sea,
Thank you very much for the reply. I used your technique and found out that the syntax error is happening here :

Code:
set history=1000
set browsedir=buffer
set clipboard+=unnamed
set: Syntax Error.

I have no idea why this error is here because I've not touched this part and used to work fine in ksh.

(And sorry about code tags, I'm being notified that I'm allowed to post it like that once I have at least 5 posts. I'm not posting full gvimrc code as this CODE tag feature is still not enabled for me)

Last edited by rishikpillai90; 05-22-2015 at 03:53 AM.. Reason: CODE tags
# 4  
Old 05-22-2015
Was it csh where one needed spaces in between to set a variable, or was that ksh too?
Try at least toq quote the appending to clipboard: set clipboard+=" unnamed"
Other than that i'm too inexperienced with ksh.

Hope this helps
# 5  
Old 05-22-2015
The above code was working good in ksh. All my problems are in tcsh.
Just tried the modification you suggested too, but didn't work.

Why say more, even syn on is also not working in tcsh, as shell says "Command not found".

So is the double quote used as comment in gvimrc. Throwing unmatched " error.

---------- Post updated at 06:11 PM ---------- Previous update was at 06:00 PM ----------

This my .gvimrc code
Code:
syn on
# general

set history=1000        # lines of Ex-mode commands, search history
set browsedir=buffer    # use directory of the related buffer for file browser
set clipboard+=" unnamed"  # use clipboard register '*' for all y, d, c, p ops
set viminfo+=!          # make sure it can save viminfo
set isk+=$,%,#,-        # none of these should be word dividers
set confirm             # raise a dialog confirm whether save changed buffer
set fenc=utf-8          # default fileencoding
set fencs=utf-8,ucs-bom,euc-jp,gb18030,gbk,gb2312,cp936
map Q gq
# do not use Ex-mode, use Q for formatting
set columns=151
set lines=38
" path/backup
set nobackup

" Set tabsize to 4 and replace tabs with spaces
set shiftwidth=2
set tabstop=2
set expandtab
set smarttab
set sm
"set guioptions-=T


" Text Formatting/Layout

set ai                  " autoindent
set si                  " smartindent
set cindent             " do C-style indenting
set fo=tcrqn            " see help (complex)
set complete=.,b,d,k,u,w,
  " Enable file type detection.
  " Use the default filetype settings, so that mail gets 'tw' set to 72,
  " 'cindent' is on in C files, etc.
  " Also load indent files, to automatically do language-dependent indenting.
set wrap


" visual cues
set showmatch           " show matching paren
set hlsearch          " do not highlight searched for phrases

set scrolloff=5         " minimal number of screen lines to keep above/below the cursor
set novisualbell        " use visual bell instead of beeping
set noerrorbells        " do not make noise
set listchars=tab:\|\ ,trail:.,extends:>,precedes:<,eol:$ " how :set list show

" Pressing < or > will let you indent/unident selected lines
vnoremap < <gv
vnoremap > >gv

" Set the font to 'Courier New' 'Regular' 'Size=10'
set guifont=monospace\ 12


" Vim UI
set selectmode=mouse,key      "select both with the mouse and shifted arrow key
set syntax=on                 " set syntax highlighting on
set linespace=0         " space it out a little more (easier to read)
set wildmenu            " type :h and press <Tab> to look what happens
set ruler               " always show current position along the bottom
set cmdheight=2         " use 2 screen lines for command-line
set lazyredraw          " do not redraw while executing macros (much faster)
set hid                 " allow to change buffer without saving
set backspace=2         " make backspace work normal
" set whichwrap+=<,>,h,l  " allow backspace and cursor keys to wrap
set mouse=a             " use mouse in all modes
set shortmess=atI       " shorten messages to avoid 'press a key' prompt
set report=0            " tell us when anything is changed via :...
set fillchars=vert:\ ,stl:\ ,stlnc:\
                        " make the splitters between windows be blank
                        "
"set cursorcolumn " highlight the current column
set cursorline " highlight current line
set incsearch " BUT do highlight as you type you search phrase
set laststatus=2 " always show the status line

" set list " we don't want to show tabs/space, to ensure we get them out of my files

set matchtime=5 " how many tenths of a second to blink matching brackets for
" set nohlsearch " do not highlight searched for phrases

set nostartofline " leave my cursor where it was
set nu
set numberwidth=5 " We are good up to 99999 lines
set showcmd " show the command being typed

" colors
"Try to load happy hacking teal colour scheme
"I copy this to ~/.vim/colors/hhteal.vim

"silent! colorscheme torte
"silent! colorscheme blue
"//"if exists("colors_name") == 0
"//"    "Otherwise modify the defaults appropriately
"//"
"//"    "background set to dark in .vimrc
"//"    "So pick appropriate defaults.
"//"    hi Normal     guifg=gray guibg=black
"//"    hi Visual     gui=none guifg=black guibg=yellow
"//"
"//"    "The following removes bold from all highlighting
"//"    "as this is usually rendered badly for me. Note this
"//"    "is not done in .vimrc because bold usually makes
"//"    "the colour brighter on terminals and most terminals
"//"    "allow one to keep the new colour while turning off
"//"    "the actual bolding.
"//"
"//"    " Steve Hall wrote this function for me on vim@vim.org
"//"    " See :help attr-list for possible attrs to pass
"//"    function! Highlight_remove_attr(attr)
"//"        " save selection registers
"//"        new
"//"        silent! put
"//"
"//"        " get current highlight configuration
"//"        redir @x
"//"        silent! highlight
"//"        redir END
"//"        " open temp buffer
"//"        new
"//"        " paste in
"//"        silent! put x
"//"
"//"        " convert to vim syntax (from Mkcolorscheme.vim,
"//"        "   Mkcolorscheme.vim - Help write colorscheme files from existing settings : vim online)
"//         delete empty,"links" and cleared" lines
"//"        silent! g/^$\| links \| cleared/d
"//"        " join any lines wrapped by the highlight command output
"//"        silent! %s/\n \+/ /
"//"        " remove the xxx's
"//"        silent! %s/ xxx / /
"//"        " add highlight commands
"//"        silent! %s/^/highlight /
"//"        " protect spaces in some font names
"//"        silent! %s/font=\(.*\)/font='\1'/
"//"
"//"         substitute bold with NONE"
"//"        execute 'silent! %s/' . a:attr . '\([\w,]*\)/NONE\1/geI'
"//"        " yank entire buffer
"//"        normal ggVG
"//"        " copy
"//"        silent! normal "xy
"//"        " run
"//"        execute @x
"//"
"//"        " remove temp buffer
"//"        bwipeout!
"//"
"//"        " restore selection registers
"//"        silent! normal ggVGy
"//"        bwipeout!
"//"    endfunction
"//"    autocmd BufNewFile,BufRead * call Highlight_remove_attr("bold")
"//"    " Note adding ,Syntax above messes up the syntax loading
"//"    " See :help syntax-loading for more info
"//"endif
highlight Pmenu guibg=yellow guifg=black
highlight PmenuSel guibg=white guifg=black

" Spell check
function! ToggleSpell()
    if !exists("b:spell")
        setlocal spell spelllang=en_gb
        let b:spell = 1
    else
        setlocal nospell
        unlet b:spell
    endif
endfunction


" Warn whenever text exceeds 78 columns.
" let w:m1=matchadd('Search', '\%<79v.\%>78v', -1)
" let w:m2=matchadd('ErrorMsg', '\%>78v.\+', -1)
set visualbell
" Map keys for user frendly shortcuts
map <C-Tab> <Esc>:tabn<CR>
imap <C-Tab> <Esc>:tabn<CR>
map <C-S-Tab> <Esc>:tabp<CR>
imap <C-S-Tab> <Esc>:tabp<CR>

And this is what the current status is :

Code:
[rpillai@mfu-blr-33:/usr2/rpillai]% $SHELL -x .gvimrc
syn on
syn: Command not found.
set history=1000
set browsedir=buffer
set clipboard+= unnamed
set: Syntax Error.

Again sorry about code tag. I'm still not able to use it.

Last edited by Scott; 05-23-2015 at 07:04 AM.. Reason: Changed [B] tags to [CODE] tags; of course it's possible to use code tags.
# 6  
Old 05-22-2015
Of course you are able to use code tags!
You are (afiak, should) not able to post URLS though...

A quote " is not a comment #.
For like every section information, you're doing a comment that starts with a quote, and therefor is taken as an open string, which requires closing quotes.
Thus resulting in any proper code in between to cause errors since open quotes break the syntax.

But me dont know gvim anyway, so i cannot be of help with this syntax, sorry and good luck.
But i'd rather have a serious investigation towards:
Code:
syn on
syn: Command not found.

Have you installed it?

hth
# 7  
Old 05-22-2015
.gvimrc sounds like an initialization file for vim and not a shell script. I'm almost certain you don't want to source or run it from the command line.
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