I want to Reread a file in VI

Posted on 2006-04-06
Last Modified: 2008-03-10

I would like to write a script that would reread from hard disk,  a file that I AM CURRENTLY EDITING IN VI.

The problem is:  How do I get VI to easyly reread the copy of the file on the hard drive without closing the file and reopening it ?


1)   I am writing a script named "myscript".

2)   I want to insert an example of a command with the CORRECT SINTAX :)

The syntax of the if...then control structure is

   if test-command

3) Now in the VI editor session I am in I want to read off the hard disk the new file contents  so I can just  change the "test-command" and the "commands" veriable.

What I am looking for is a nice helping aid in case I get a job shell scripting and have problems with the syntax.   People look at you funny if you paste in all the examples !!!

Question by:bitmechanic
    LVL 84

    Accepted Solution

    :r file

    Author Comment

    with :r file I get the contents appened to the end of my file.

    I now have the file twice in my file


    Author Comment

    Actually I did not know that was what I wanted however it cleary was and I do not even need the script to do it.


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
    FreeBSD on EC2 FreeBSD ( is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now