Vim Tips Wiki
Register
(Change to TipImported template + severe manual clean)
No edit summary
Line 1: Line 1:
  +
<math>Insert formula here</math>[[Media:Example.ogg]]
{{review}}
 
{{TipImported
 
|id=745
 
|previous=744
 
|next=746
 
|created=June 15, 2004
 
|complexity=advanced
 
|author=Steve Hall
 
|version=6.0
 
|rating=13/4
 
}}
 
 
I recently needed the value of $VIMRUNTIME in a bash shell script and was forwarded these two terrific solutions that may be of use to others.
 
I recently needed the value of $VIMRUNTIME in a bash shell script and was forwarded these two terrific solutions that may be of use to others.
   

Revision as of 02:55, 10 January 2008

Media:Example.ogg I recently needed the value of $VIMRUNTIME in a bash shell script and was forwarded these two terrific solutions that may be of use to others.

vim --cmd 'echo $VIMRUNTIME' --cmd 'quit' 2> /tmp/VIMRUNTIME.txt
VIMRUNTIME=`perl -pe 's/\r\n//g' /tmp/VIMRUNTIME.txt`
rm -f /tmp/VIMRUNTIME.txt
VIMRUNTIME=`vim -e -T dumb --cmd 'exe "set t_cm=\<C-M>"|echo $VIMRUNTIME|quit' | tr -d '\015' `

Both properly capture Vim's output and handle the trailing line feed, although in remarkably different ways.

Comments