Solved

Read Command in Linux

Posted on 2006-07-13
5
877 Views
Last Modified: 2013-12-13
How would you read a variable in a VI editor example  20, 30, 40? and execute it in Linux?
0
Comment
Question by:mayan1
5 Comments
 
LVL 4

Expert Comment

by:yurisk
ID: 17100887
What do you mean? What are you trying to accomplish?
Variable cannot be executed - only read,written..
0
 
LVL 22

Expert Comment

by:pjedmond
ID: 17102367
vi has a scripting language, but I have only rarely used it:

http://en.wikibooks.org/wiki/Learning_the_vi_editor/Vim#Ex.2FExim_Script_language

for more information. It may be able to do what you want, but I'm sure that there are easier ways!

http://www.vim.org/htmldoc/tips.html

is part of the official vim manual

(   (()
(`-' _\
 ''  ''
0
 
LVL 34

Expert Comment

by:Duncan Roe
ID: 17103653
This is a follow-on from http://www.experts-exchange.com/Programming/Programming_Platforms/Linux_Programming/Q_21916872.html right?
You don't use vi to do the read. You use vi to create a script which does the read
0
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 50 total points
ID: 17103687
Ok here's an example:

#!/bin/sh
echo -n "Enter a number: "
read i
echo "You entered $i"
0
 
LVL 48

Expert Comment

by:Tintin
ID: 17104655
Do you mean run a script from vi and read the output?

If so, in vi do:

Esc:r!/path/to/script
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

18 Experts available now in Live!

Get 1:1 Help Now