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?

Colin

what does

ruby -e “system 'which echo’”

tell you?

/Walther

On Tue, Mar 8, 2016 at 7:48 AM, Colin L. [email protected] wrote:

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

It is - google “bash builtin commands” (assuming you’re using bash
as your default shell).


Hassan S. ------------------------ [email protected]
http://about.me/hassanschroeder
twitter: @hassan
Consulting Availability : Silicon Valley or remote

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