# A newbie. not getting run a script

**URL:** <https://rubytalk.org/t/a-newbie-not-getting-run-a-script/26594>\
**Category:** ruby-talk\
**Created:** [12 April 2006 07:39 UTC](https://rubytalk.org/t/a-newbie-not-getting-run-a-script/26594 "2006-04-12T07:39:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![\_Pena\_Botp1](https://avatars.discourse-cdn.com/v4/letter/_/94ad74/32.png) [@\_Pena\_Botp1](https://rubytalk.org/u/_Pena_Botp1)\
**Post date:** [12 April 2006 07:39 UTC](https://rubytalk.org/t/a-newbie-not-getting-run-a-script/26594/1 "2006-04-12T07:39:35Z")

</div>

san wrote last Wednesday, April 12, 2006 1:45 PM:

#i have tried all the methods above but in vain  
#line by line commands are being executed but i could not run  
#the program  
#as a whole

> **···**
>
> #  
> #i have a screenshot of the commands. if you can plese look into it and  
> #give your comments where i am going wrong. the first lines are same as  
> #that in the file count.rb  
> #  
> #since i could not upload image in this forum, i have created a blogger  
> # [http://santanusasmal.blogspot.com/](http://santanusasmal.blogspot.com/)
> 
> you reminded me of my son 🙂
> 
> maybe we should start slowly and ask ourselves first: what is a shell? what is irb? what is a ruby interpreter? what is a ruby program?
> 
> irb is an interactive \_ruby\_ shell, similar to windows command shell. Unlike windows's shell however, in irb you enter ruby commands.
> 
> windows's shell does not understand ruby commands. Ergo, to run a ruby program under windows, you need to invoke a ruby interpreter. There are two kinds of interpeter in ruby, one is the plain interpreter named "ruby", and the other is the ruby shell named "irb".
> 
> anyway, try playing like this...
> 
> C:\Documents and Settings\botp\>irb -v  
> irb 0.9.5(05/04/13)
> 
> C:\Documents and Settings\botp\>ruby -v  
> ruby 1.8.4 (2005-12-24) [i386-mswin32]
> 
> C:\Documents and Settings\botp\>type count.rb  
> 5.times {|x| puts "count #{x}"}
> 
> C:\Documents and Settings\botp\>ruby count.rb  
> count 0  
> count 1  
> count 2  
> count 3  
> count 4
> 
> C:\Documents and Settings\botp\>irb  
> irb(main):001:0\> require "count.rb"  
> count 0  
> count 1  
> count 2  
> count 3  
> count 4  
> =\> true  
> irb(main):002:0\> 5.times {|x| puts "count #{x}" }  
> count 0  
> count 1  
> count 2  
> count 3  
> count 4  
> =\> 5  
> irb(main):003:0\> 1+1  
> =\> 2  
> irb(main):004:0\> print "hello, world"  
> hello, world=\> nil  
> irb(main):005:0\> system("ruby count.rb")  
> count 0  
> count 1  
> count 2  
> count 3  
> count 4  
> =\> true  
> irb(main):006:0\> `ruby count.rb`  
> =\> "count 0\ncount 1\ncount 2\ncount 3\ncount 4\n"  
> irb(main):007:0\> quit
> 
> C:\Documents and Settings\botp\>
> 
> hth.
> 
> btw, Pine's and Slagell's ruby books are great for beginners.
> 
> kind regards -botp
> 
> #regards  
> #santanu
