scripts in vi

Page principale
Attachements:
Message en tant que courrier électronique
+ (text/plain)
Supprimer ce message
Répondre à ce message
Auteur: G.D.Thurman
Date:  
Sujet: scripts in vi
On Thu, 27 Jun 2002, Greg wrote:

> For example a script that would insert a date into a document.
>

+ Press ESC (i.e. make sure 'vi' is not in an insert-mode)
+ Go to the spot in your file where you want to insert
the output of a command.
+ Execute the command using the 'r'ead command as follows...

:r !date

Example:

I'm using 'vi' right now at
Thu Jun 27 10:08:49 MST 2002

---

What is :r !date ?

Enter into colon : mode (also know as 'ed' mode)
and execute the 'r'ead command followed by ! and
then a command-line.