[comp.sys.att] Strangeness in shell

pjh@mccc.UUCP (Pete Holsberg) (07/18/89)

If I assign a shell variable a value that contains an asterisk, the
shell behaves strangely if there is a space adjacent to said asterisk. 
For example,
	x='*z'
	echo ${x}
produces
	*z
but 
	x='* z'
	echo ${x}
produces
	(a list of all the files in the current directory) z
	
What does the space have to do with this?

Please mail and I'll summarize if there is interest.  Thanks.

-- 
Pete Holsberg -- Mercer College -- Trenton, NJ 08690
...!rutgers!njin!princeton!njsmu!mccc!pjh

IA80001@MAINE.BITNET (George Newell) (07/20/89)

When you put the asterisk (*) on a line with spaces around it, the shell will
substitute all the names in the current directory for it.  Apparently, when you
included the letter after the asterisk and space, the shell interpreted the
letter as a path name for the directory listing to print.  I hope this info
helps.

George Newell
IA80001@MAINE.BITNET

uri@arnor.UUCP (Uri Blumenthal) (07/21/89)

From article <1643IA80001@MAINE>, by IA80001@MAINE.BITNET (George Newell):
> When you put the asterisk (*) on a line with spaces around it, the shell will
> substitute all the names in the current directory for it.  Apparently, when you
> included the letter after the asterisk and space, the shell interpreted the
> letter as a path name for the directory listing to print.  I hope this info
> helps.
> 
>
Disagree. Shell tries to substitute _special_ symbols. Means - when it
sees "normal" letter - it will echo it, simply. So the output of
   echo * x
will be:
  <current directory list> x

That's it.
-----------------------
<Standard Disclaimer>