doubts about variables in ruby

J

Junior Linux

well my doubt is:

I want to make a ruby program that number in a URL and checks if the url
has a forum. for exemple :

puts("enter an address");
endereco =gets()
@forum = "/forum"
system("firefox "+ endereco+ @forum);

the code does not work, it opens the page with the site but the variable
@ forum runs only after I close the open page, and as command not found
(like I try to use the command / forum)

how can i put it all together and make url.com / forum?


PS : Sorry for my spelling errors, I'm from Brazil :D
 
P

pharrington

well my doubt is:

I want to make a ruby program that number in a URL and checks if the url
has a forum. for exemple :

puts("enter an address");
endereco =gets()
@forum = "/forum"
system("firefox "+ endereco+ @forum);

the code does not work, it opens the page with the site but the variable
@ forum runs only after I close the open page, and as command not found
(like I try to use the command / forum)

how can i put it all together and make url.com / forum?

PS : Sorry for my spelling errors, I'm from Brazil :D

gets() retains the newline when the user presses enter
try stripping the newline (endereco = gets().chomp)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top