[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Read Command in Linux

Posted on 2006-07-13
5
Medium Priority
?
892 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 35

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 35

Accepted Solution

by:
Duncan Roe earned 200 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month20 days, 8 hours left to enroll

867 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