Vim Tips Wiki
Register
m (Find $VIMRUNTIME in a bash script moved to Find VIMRUNTIME in a bash script: Page moved by JohnBot to improve title)
(Change to TipImported template + severe manual clean)
Line 1: Line 1:
 
{{review}}
 
{{review}}
  +
{{TipImported
{{Tip
 
 
|id=745
 
|id=745
  +
|previous=744
|title=Find $VIMRUNTIME in a bash script
 
  +
|next=746
|created=June 15, 2004 19:05
+
|created=June 15, 2004
 
|complexity=advanced
 
|complexity=advanced
 
|author=Steve Hall
 
|author=Steve Hall
 
|version=6.0
 
|version=6.0
 
|rating=13/4
 
|rating=13/4
 
}}
|text=
 
I recently needed the value of $VIMRUNTIME in a bash shell script and was forwarded these two terrific solutions I wanted to post publically:
+
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.
   
1. by Luc St-Louis
 
 
<pre>
 
<pre>
vim --cmd 'echo $VIMRUNTIME' --cmd 'quit' 2&gt; /tmp/VIMRUNTIME.txt
+
vim --cmd 'echo $VIMRUNTIME' --cmd 'quit' 2&gt; /tmp/VIMRUNTIME.txt
VIMRUNTIME=`perl -pe 's/\r\n//g' /tmp/VIMRUNTIME.txt`
+
VIMRUNTIME=`perl -pe 's/\r\n//g' /tmp/VIMRUNTIME.txt`
rm -f /tmp/VIMRUNTIME.txt
+
rm -f /tmp/VIMRUNTIME.txt
 
</pre>
 
</pre>
   
  +
<pre>
2. by Jacob Lerner
 
<pre>VIMRUNTIME=`vim -e -T dumb --cmd 'exe "set t_cm=\&lt;C-M&gt;"|echo $VIMRUNTIME|quit' | tr -d '\015' ` </pre>
+
VIMRUNTIME=`vim -e -T dumb --cmd 'exe "set t_cm=\&lt;C-M&gt;"|echo $VIMRUNTIME|quit' | tr -d '\015' `
  +
</pre>
   
 
Both properly capture Vim's output and handle the trailing line feed, although in remarkably different ways.
   
 
==Comments==
Both properly capture Vim's output and handle the trailing line feed, although in remarkable different ways. Feel free to post additional solutions below.
 
   
 
}}
 
 
== Comments ==
 
what use is the variable? when you have vim?
 
 
motim
 
, June 15, 2004 19:13
 
 
----
 
----
<!-- parsed by vimtips.py in 0.517127 seconds-->
 
 
 
[[Category:Integration]]
 
[[Category:Integration]]

Revision as of 01:28, 11 November 2007

Tip 745 Printable Monobook Previous Next

created June 15, 2004 · complexity advanced · author Steve Hall · version 6.0


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