Solved

Read Command in Linux

Posted on 2006-07-13
5
884 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

839 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