Read Command in Linux

How would you read a variable in a VI editor example  20, 30, 40? and execute it in Linux?
mayan1Asked:
Who is Participating?
 
Duncan RoeConnect With a Mentor Software DeveloperCommented:
Ok here's an example:

#!/bin/sh
echo -n "Enter a number: "
read i
echo "You entered $i"
0
 
yuriskCommented:
What do you mean? What are you trying to accomplish?
Variable cannot be executed - only read,written..
0
 
pjedmondCommented:
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
 
Duncan RoeSoftware DeveloperCommented:
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
 
TintinCommented:
Do you mean run a script from vi and read the output?

If so, in vi do:

Esc:r!/path/to/script
0
All Courses

From novice to tech pro — start learning today.