# sign does not work as expected form irb

I have just started Ruby. I have tried to do some exercises usin irb but
this is what happens if I write the following code msg = "Hello "
#{name} ":

irb:157:0> #msg "Hello,
irb:158:0>*

As as soon as I enter the # sign after the Hello it moves to the
beggining of the line and a new line appears.

My computer works with Windows XP.

How can I change the way the # sign works+

Salvador S. wrote:

I have just started Ruby. I have tried to do some exercises usin irb but
this is what happens if I write the following code msg = "Hello "
#{name} ":

Please try this :
msg = "Hello #{name} ".

Aldric G. wrote:

Salvador S. wrote:

I have just started Ruby. I have tried to do some exercises usin irb but
this is what happens if I write the following code msg = "Hello "
#{name} ":

Please try this :
msg = "Hello #{name} ".

Sorry in my initial post I’ve made I mistake.

I already wrote the code as you are proposing me. The problem is that
the # sign goes to the start of the line as soon as I type it, and opens
an new line.

It must be something to do with the irb and my keyboard configuration
but I’ve just started with ruby and have no idea.

Thank you very much.

I’ve never heard of or seen this behavior.
What keyboard are you using? In what language is Windows XP? What key
combination do you use to get # (for me, it’s Shift-3)? What tool do you
use for irb? is it cmd.exe ?

Hi,

Am Donnerstag, 27. Aug 2009, 16:18:35 +0900 schrieb Salvador S.:

It must be something to do with the irb and my keyboard configuration
but I’ve just started with ruby and have no idea.

The Hash sign introduces a comment (outside “”).

http://www.ruby-doc.org/docs/ProgrammingRuby/html/intro.html#S2

Bertram

Aldric G. wrote:

I’ve never heard of or seen this behavior.
What keyboard are you using? In what language is Windows XP? What key
combination do you use to get # (for me, it’s Shift-3)? What tool do you
use for irb? is it cmd.exe ?

The keyboard is forma IBM. The language is Spanish international. To get

I use AltGr+3

The tool I use is irb.

2009/8/27 Salvador S. [email protected]:

I already wrote the code as you are proposing me. The problem is that
the # sign goes to the start of the line as soon as I type it, and opens
an new line.

It must be something to do with the irb and my keyboard configuration
but I’ve just started with ruby and have no idea.

Maybe it’s not IRB but your terminal.

Cheers

robert

Salvador S. wrote:

Aldric G. wrote:

I’ve never heard of or seen this behavior.
What keyboard are you using? In what language is Windows XP? What key
combination do you use to get # (for me, it’s Shift-3)? What tool do you
use for irb? is it cmd.exe ?

The keyboard is forma IBM. The language is Spanish international. To get

I use AltGr+3

The tool I use is irb.

Where does IRB run? In a command-line window? A special program? (I use
a tool called ‘console2’ which I got from sourceforge).

If you type the # in a regular terminal / command-line window, does it
go to the next line? I suspect that AltGr is the problem, but I am not
sure.

Aldric G. wrote:

Salvador S. wrote:

Aldric G. wrote:

I’ve never heard of or seen this behavior.
What keyboard are you using? In what language is Windows XP? What key
combination do you use to get # (for me, it’s Shift-3)? What tool do you
use for irb? is it cmd.exe ?

The keyboard is forma IBM. The language is Spanish international. To get

I use AltGr+3

The tool I use is irb.

Where does IRB run? In a command-line window? A special program? (I use
a tool called ‘console2’ which I got from sourceforge).

If you type the # in a regular terminal / command-line window, does it
go to the next line? I suspect that AltGr is the problem, but I am not
sure.

The IRB runs on command-line window. But it does just the same with fxri
for example.

If I type # the character moves to the beggining of the line and opens a
new line.

Robert K. wrote:

2009/8/27 Salvador S. [email protected]:

for example.

If I type # the character moves to the beggining of the line and opens a
new line.

I have no idea how you would provoke that effect in a Windows XP
command window. I can type as many # as I want, the cursor does not
jump. Maybe reboot? :wink:

robert

It doesn’t work either. Thanks for your time

2009/8/27 Salvador S. [email protected]:

for example.

If I type # the character moves to the beggining of the line and opens a
new line.

I have no idea how you would provoke that effect in a Windows XP
command window. I can type as many # as I want, the cursor does not
jump. Maybe reboot? :wink:

robert

What about other special characters like AltGr 6, AltrGr 7, etc? What do
those do?

Aldric G. wrote:

What about other special characters like AltGr 6, AltrGr 7, etc? What do
those do?
I only have (AltGr + º), |(AltGr +1)and @(AltGr +2). They work well.

Hi,

2009/8/27 Salvador S. [email protected]:

My computer works with Windows XP.

How can I change the way the # sign works+

I guess your ruby is 1.8.6 OCI version.
This problem is due to the bug of readline.dll(Readline-4.3-2).
The behavior is “rl_insert_comment”.

Try following:

  1. Create a file named “inpurc” in your ruby binary directory with the
    content
    “\M-#”: “#”

  2. Create an environment variable in the System Properties->Advanced
    Tab->Environment Variables area called INPUTRC and set it to
    c:\ruby\bin\inputrc

Regards,

Park H.

Heesob P. wrote:

Hi,

2009/8/27 Salvador S. [email protected]:

My computer works with Windows XP.

How can I change the way the # sign works+

I guess your ruby is 1.8.6 OCI version.
This problem is due to the bug of readline.dll(Readline-4.3-2).
The behavior is “rl_insert_comment”.

Try following:

  1. Create a file named “inpurc” in your ruby binary directory with the
    content
    “\M-#”: “#”

  2. Create an environment variable in the System Properties->Advanced
    Tab->Environment Variables area called INPUTRC and set it to
    c:\ruby\bin\inputrc

Regards,

Park H.

Hi Park I tried what you told me and it worked. I had to add the text on
a file named inputrc.euro that is in the same directory so other keys
will work as well.

Thank you very much.

Salvador S.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs