title: Running a shell script in .vimrc (and processing the output)
body: <p>I am trying to run a shell script from within a .vimrc file (three problems marked in the script):</p>
  
  <pre><code>function! CheckMe(file)
      let shellcmd = 'checkme '.a:file
  
      " Start the command and return 0 on success.
      " XXX: How do you evaluate the return code?
      execute '!'.shellcmd
      if !result
          return 0
      endif
  
      " Ending up here, the command returned an error.
      " XXX: Where to you get the output?
      let pair = split(output, '\S')
      let line = pair[0]
      let char = pair[1]
  
      " Jump to the errenous column and line.
      " XXX: Why does this not work?
      normal '/\%'.line.'l\%'.char.'c'
      return 1
  endfunction
  </code></pre>
  
  <p>So to summarize, how do you get the result/output of the script, and why does the jump statement not work?</p>
  
  <p>Additional details:</p>
  
  <ul>
  <li>The shell script returns 0 on success, and 1 on failure. On a failure, the script prints two numbers (line and column number) to stdout, separated by a space character.</li>
  <li>According to the <a href="http://vimdoc.sourceforge.net/htmldoc/various.html#:normal" rel="noreferrer">Vim docs</a>, the argument of the "normal" keyword is "executed like it is typed", but apparently that is not the case. It works fine when I type it (in the normal command mode, without leading ':'), but doesn't in the script ("E78: Unknown mark).</li>
  </ul>