Subject: Re: Variable assignment in Bourne-like shells
To: Lucio de Re <lucio@proxima.alt.za>
From: Marc Slemko <marcs@znep.com>
List: tech-userlevel
Date: 02/09/1998 00:33:33
On Mon, 9 Feb 1998, Lucio de Re wrote:

> I get the following, using either /bin/sh or /usr/bin/ksh:
> 
> 	$ MORE="-e -x4 -i"; echo $MORE
> 	-x4 -i
> 
> quite unexpectedly, but, more to my taste,
> 
> 	$ MORE="-x4 -e -i"; echo $MORE
> 	-x4 -e -i
> 
> Is this expected behaviour, or should I dig in the shell source innards 
> to fix it?

Expected.

Expand the variable to see what you are actually doing:

	echo -e -x4 -i

What would you expect from that?  Exactly what you get.

Try echo "$MORE" instead.