3

I have output from static analyzer, that I parsed with Bash.

Now I want Vim to run on specified by analyzer line and add comment containing warning id and description.

I tried this,

vim $file +$line+'normal A'+'/* KW: $kwid desc: $desc */'

Where $file is the path to file, $line line number, $kwid and $desc are strings that describe what problem I'm working on for this case.

oxr463
  • 103
  • 1
  • 4
user23336
  • 31
  • 1

1 Answers1

1

Try this:

vim "$file" +$line +"normal! A/* KW: $your text $here */"

Parameter expansion does not happen in single quotes in bash.

Each command given to vim get’s one + (it is not like string concatenation at all).

D. Ben Knoble
  • 26,070
  • 3
  • 29
  • 65