54 lines
3.1 KiB
HTML
54 lines
3.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE>3.12.10 Running shell commands</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value="3.12.10 Running shell commands">
|
|
<meta name="keywords" value="gs">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3615 HREF="node148.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3613 HREF="node137.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3607 HREF="node146.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3617 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3618 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3616 HREF="node148.html">3.12.11 Getting help</A>
|
|
<B>Up:</B> <A NAME=tex2html3614 HREF="node137.html">3.12 Using the vi </A>
|
|
<B> Previous:</B> <A NAME=tex2html3608 HREF="node146.html">3.12.9 Including other files</A>
|
|
<BR> <HR> <P>
|
|
<H2><A NAME=SECTION0051210000000000000000>3.12.10 Running shell commands</A></H2>
|
|
<P>
|
|
<A NAME=3965> </A>
|
|
You can also run shell commands from within <tt>vi</tt>. The <tt>:r!</tt> command
|
|
works like <tt>:r</tt>, but instead of reading a file, it inserts the
|
|
output of the given command into the buffer at the current cursor location.
|
|
For example, if you use the command
|
|
<P><TT> :r! ls -F
|
|
<P></TT>
|
|
you'll end up with
|
|
<P><TT> <IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img237.gif"> <P></TT>
|
|
<P>
|
|
You can also ``shell out'' of <tt>vi</tt>, in other words, run a command
|
|
from within <tt>vi</tt>, and return to the editor when you're done. For
|
|
example, if you use the command
|
|
<P><TT> :! ls -F
|
|
<P></TT>
|
|
the <tt>ls -F</tt> command will be executed, and the results displayed on
|
|
the screen, but not inserted into the file which you're editing.
|
|
If you use the command
|
|
<P><TT> :shell
|
|
<P></TT>
|
|
<tt>vi</tt> will start an instance of the shell, allowing you to temporarily
|
|
put vi ``on hold'' while you execute other commands. Just logout of the
|
|
shell (using the <tt>exit</tt> command) to return to <tt>vi</tt>.
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html3615 HREF="node148.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html3613 HREF="node137.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html3607 HREF="node146.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html3617 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html3618 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html3616 HREF="node148.html">3.12.11 Getting help</A>
|
|
<B>Up:</B> <A NAME=tex2html3614 HREF="node137.html">3.12 Using the vi </A>
|
|
<B> Previous:</B> <A NAME=tex2html3608 HREF="node146.html">3.12.9 Including other files</A>
|
|
<BR> <HR> <P>
|
|
<BR> <HR>
|
|
<P><ADDRESS>
|
|
<I>Matt Welsh <BR>
|
|
mdw@sunsite.unc.edu</I>
|
|
</ADDRESS>
|
|
</BODY>
|