system command and echo strangeness

Can anyone explain this?

If in a terminal I run echo -e 'hello' I see, as one would expect, $ echo -e 'hello' hello

However if I execute the command using irb I see $ irb 2.1.3 :001 > system "echo -e 'hello'" -e hello => true

It echoes the option which suggests to me that echo does not recognise -e If however I do 2.1.3 :003 > system "/bin/echo -e 'hello'" hello => true

Which implies that when I do not specify the path it is using a different version of echo.

I also see 2.1.3 :005 > system "which echo" /bin/echo => true

But I am not sure that is relevant. Google has not helped me in this matter.

This is using gnome-terminal in Ubuntu 16.04 (and 14.04)

Any suggestions anyone?


what does

ruby -e "system 'which echo’"

tell you?


It is - google "bash builtin commands" (assuming you're using bash as your default shell).