How to allow .rb files to be executed locally.
From the official Ruby page Select the recommended version (=>) and install
https://rubyinstaller.org/downloads/
Ruby + Devkit 2.6.6-1 (x64) is 130MB.
** ▼ Check I accept the License **
** ▼ Click Install **
** ▼ Click Next **
** ▼ Click Finish **
** ▼ Enter 1 and 3 and Enter **
▼Enter
Installation is complete.
ruby -v
If it is installed, the version will be displayed.
(↑ Use gitbush)
command
#Go to desktop
$ cd ~/desktop
#.rb file creation
$ touch index.rb
#launch vim editor
$ vi index.rb
The vim editor will be launched, so enter the following
index.rb
puts "Hello"
puts 1+2*3
"I": Insert mode "Esc": Exit from insert mode ": Wq": Save and close
command
#Execute ruby (OK if the contents are output)
$ ruby index.rb
Hello
7
#File deletion
$ rm index.rb
that's all. It took longer than I expected to download, but it's relatively fast after that.
Recommended Posts