Vim Tips Wiki
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
FANDOM
Explore
Current Wiki
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
Vim Tips Wiki
1,649
pages
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
Editing
Find VIMRUNTIME in a bash script
Back to page
Edit
Edit source
View history
Talk (0)
Edit Page
Find VIMRUNTIME in a bash script
We recommend that you
log in
before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your
Watchlist
.
Creating an account
is quick and free.
The edit appears to have already been undone.
Anti-spam check. Do
not
fill this in!
{{review}} {{TipImported |id=745 |previous=744 |next=746 |created=June 15, 2004 |complexity=advanced |author=Steve Hall |version=6.0 |rating=13/4 |category1=Integration |category2= }} 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. <pre> 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 </pre> <pre> VIMRUNTIME=`vim -e -T dumb --cmd 'exe "set t_cm=\<C-M>"|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==
Summary:
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Navigation
(
view source
)
Template:Review
(
view source
)
Template:TipImported
(
view source
)
Follow on IG
TikTok
Join Fan Lab