Administration
  Home arrow Administration arrow Page 5 - Vi 201
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Developerworks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ADMINISTRATION

Vi 201
By: Vikram Vaswani, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2000-05-11

    Table of Contents:
  • Vi 201
  • Liar, Liar...
  • Re-thinking Relativity
  • Sweet Revenge
  • The Shell Game
  • First Aid 101
  • An Indent In Time...
  • Exit Flootburger

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    The Best Selling PC Migration Utility.
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Vi 201 - The Shell Game
    (Page 5 of 8 )

    The guys who created vi built in all kinds of creature comforts designed to reduce your interaction with the shell to a minimum. One of the coolest ideas they came up with was a "shell filter", which allows you to replace shell commands with their output without needing to leave the editor at all.

    Try this - open up a blank document and type

    Today's date is date
    Now exit insert mode, position the cursor over the second "date" in that line, and type

    !!bash
    The line should now read

    Today's date is Tue May 2 15:54:13 IST 2000
    or whatever the current date and time happens to be on your system. Vi passes the word under the cursor to the interpreter specified by the user - the "bash" shell, in this case - as a command, and then replaces the word with the output of that command.

    Despite these time-saving features, there are times when you'll want to execute a shell command directly. In vi, you can do this with

    :! <shell-command>
    So, if you needed a quick directory listing of the /home directory, you could type

    :! ls -l /home
    and vi would pass the command to the shell, and display the output to you.

    Finally, vi also allows you to spawn a new shell with the

    :shell
    command. You can then execute shell commands and run other programs - even a new instance of vi, although only the truly warped among you would find this entertaining.

    Once you're done, simply log out of the spawned shell by typing

    ^-D
    and you'll be returned to your original vi session.

    This article copyright Melonfire 2000. All rights reserved.

    More Administration Articles
    More By Vikram Vaswani, (c) Melonfire


     

       

    ADMINISTRATION ARTICLES

    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization
    - Advanced Concepts on Dealing with Files and ...
    - Dealing with Files and Filesystems
    - More Hacks for the User Environment in BSD
    - Personalizing the User Environment in BSD
    - Customizing the User Environment in BSD




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway