Results 1 to 9 of 9
I have installed ruby-1.8.2-11.8.i586.rpm into my Suse 10.2 Machine. How do i run my scripts? Please Help.
The-Wise-Man...
- 07-16-2007 #1Just Joined!
- Join Date
- May 2007
- Location
- Out in the woods with the only computer for 169 miles.
- Posts
- 62
Ruby
I have installed ruby-1.8.2-11.8.i586.rpm into my Suse 10.2 Machine. How do i run my scripts? Please Help.
The-Wise-Man
- 07-16-2007 #2
Type:
So, if your script was in your ~/scripts folder, you could do one of two things:Code:ruby <name of script>
orCode:ruby ~/scripts/<script name>
Hope that helps.Code:cd ~/scripts ruby <name of script>
Looking for a distro? Look here.
"There can be no doubt that all our knowledge begins with experience." - Immanuel Kant (Critique of Pure Reason)
Queen's University - Arts and Science 2008 (Sociology)
Registered Linux User #386147.
- 07-16-2007 #3Just Joined!
- Join Date
- May 2007
- Location
- Out in the woods with the only computer for 169 miles.
- Posts
- 62
Casey@linux:~> ruby '/home/Casey/Desktop/testing.rb'
/home/Casey/Desktop/testing.rb:1: syntax error, unexpected tIDENTIFIER, expecting $end
puts 'Casey it's Working great'
^
Casey@linux:~> su
Password:
linux:/home/Casey # ruby '/home/Casey/Desktop/testing.rb'
/home/Casey/Desktop/testing.rb:1: syntax error, unexpected tIDENTIFIER, expecting $end
puts 'Casey it's Working great'
^
linux:/home/Casey #
Error
- 07-17-2007 #4
There is no need to make the text large to make the point.
Could you please post your code here as there appears to be a syntax error with your code.Looking for a distro? Look here.
"There can be no doubt that all our knowledge begins with experience." - Immanuel Kant (Critique of Pure Reason)
Queen's University - Arts and Science 2008 (Sociology)
Registered Linux User #386147.
- 07-17-2007 #5Just Joined!
- Join Date
- May 2007
- Location
- Out in the woods with the only computer for 169 miles.
- Posts
- 62
The Ruby program? i just made a testing 1 it looks like this
puts 'Testing'
gets
When i try to type ruby name of script nothing happens cant even type in Konsole
The-Wise-Man
- 07-17-2007 #6
You must invoke ruby to run a ruby script. In the first case above The error looks like a shell script error. So you simply typed "test.rb" you must type
ruby test.rb
Linux knows nothing about extensions. So it sees the text only as text. If you flag the text as executable and it is not a binary then the shell program will attempt to execute the text as a shell script. Note some extension recognition is normally in the GUI's ie you can associate extensions with certain programs. You could associate .rb with ruby then when a .rb file is clicked it is opened with the ruby program. But this is a property of the GUI not of the console or Linux kernel. There is no difference with this then with windows and DOS shells in the MS world.
- 07-17-2007 #7Just Joined!
- Join Date
- May 2007
- Location
- Out in the woods with the only computer for 169 miles.
- Posts
- 62
Thats what im doing but then i get this error
Casey@linux:~> ruby '/home/Casey/Desktop/testing.rb'
/home/Casey/Desktop/testing.rb:1: syntax error, unexpected tIDENTIFIER, expecting $end
puts 'Casey it's Working great'
^
Casey@linux:~> su
Password:
linux:/home/Casey # ruby '/home/Casey/Desktop/testing.rb'
/home/Casey/Desktop/testing.rb:1: syntax error, unexpected tIDENTIFIER, expecting $end
puts 'Casey it's Working great'
^
linux:/home/Casey #
This is all i get
Its supposed to say
Its working great casey
and then its supposed to wait until i hit enter
- 07-17-2007 #8
Well this is a syntax error in any language. I Don't know ruby. But you are simply missing something. Maybe an include file??
/home/Casey/Desktop/testing.rb:1: syntax error, unexpected tIDENTIFIER, expecting $end
puts 'Casey it's Working great'
^
This indicates there is a problem with this line. Is puts a command in Ruby?
try
$stdout.puts( "Casey it's Working great")
In theory all puts commands should resolve to this. It appears some sort of preprocessing is happening.
Note double quotes. Don't know if that is important but all examples I looked up had double not single quotes.
In any case it appears you have it installed.
This seems to be a good over view site.
Programming Ruby: The Pragmatic Programmer's Guide
- 07-17-2007 #9
Turns out I have ruby installed. Must have installed it via Yast at some time in the past. I tend to collect programmer stuff.
Works here no problem. Did you install via Yast or smart. There is some mention of a rubyconf program that is supposed to set up the Ruby environment. Maybe you need to run that or install from a Suse repository like I apparently did.


Reply With Quote