echo difference between ubuntu and RedHat

Posted by arcomber on Ask Ubuntu See other posts from Ask Ubuntu or by arcomber
Published on 2014-08-23T09:39:47Z Indexed on 2014/08/23 10:35 UTC
Read the original article Hit count: 112

I have mostly been experimenting with ubuntu but recently was using a Red Hat Enterprise system and was surprised at a difference I found setting and displaying env variables.

In ubuntu I might have an interaction like this:

acomber@mail:~$ export MY_VAR=i686-linux
acomber@mail:~$ echo $MY_VAR
i686-linux
acomber@mail:~$ echo "$MY_VAR"
i686-linux

But on RHEL:

acomber@mail:~$ export MY_VAR=i686-linux
acomber@mail:~$ echo $MY_VAR

acomber@mail:~$ echo "$MY_VAR"
i686-linux

I know this is a ubuntu forum but why the difference? Why do I need to enclose in quotes on RH? There are no spaces in the variable name?

© Ask Ubuntu or respective owner

Related posts about command-line

Related posts about bash