Computing.Net > Forums > Unix > running unix command in vi session

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

running unix command in vi session

Reply to Message Icon

Name: kamalpreet
Date: July 3, 2007 at 22:30:08 Pacific
OS: Solaris
CPU/Ram: Ultra 60
Product: Sun
Comment:

how can I run simple unix commands like pwd ,ls or cd in vi editor without quiting the vi session.

Warm Regards
Kamalpreet Singh



Sponsored Link
Ads by Google

Response Number 1
Name: wollie
Date: July 3, 2007 at 23:36:04 Pacific
Reply:

try :!ls


0

Response Number 2
Name: James Boothe
Date: July 5, 2007 at 13:14:16 Pacific
Reply:

You can also read the output of unix commands into the file you are editing (inserted below the current line), such as:

:r !pwd

:r !echo $APPL_TOP

:r !ls -l


0

Response Number 3
Name: kamalpreet
Date: July 5, 2007 at 22:27:33 Pacific
Reply:

I tried this...My .cshrc has a banner command which dispalys a messages..

with :r !pwd that banner message also appears in file

Warm Regards
Kamalpreet Singh


0

Response Number 4
Name: James Boothe
Date: July 9, 2007 at 13:25:13 Pacific
Reply:

Yes, the entire stdout of a command will be read into your file.

And of course, you can filter that output:

:r !pwd|grep -v whatever

or maybe:

:r !pwd|grep /


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: running unix command in vi session

multiple unix commands in 1 session www.computing.net/answers/unix/multiple-unix-commands-in-1-session/8297.html

Running Unix commands in parallel www.computing.net/answers/unix/running-unix-commands-in-parallel/6259.html

Run Unix command in DOS FTP prompt. www.computing.net/answers/unix/run-unix-command-in-dos-ftp-prompt/8494.html