Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!sumax!thebes!quick!steven!fawcett From: fawcett@steven.COM (fawcett) Newsgroups: comp.unix.questions Subject: Re: Strangeness in shell Summary: Enclose the ${x} in quotes Keywords: SysV Bourne shell Message-ID: <53@steven.COM> Date: 21 Jul 89 17:26:45 GMT References: <432@mccc.UUCP> Distribution: na Organization: Sierra Geophysics Inc., Kirkland, Wa. Lines: 54 >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 The problem here is that the "set" of x stripped off the single quotes. This left only the *, which matches all occourances of one or more characters. Why it looked in your directory for these files I don't know. The fact that the *z echoed simply means that you don't have any files in your directory that end in the letter z. Try doing a ls *. This will list every file in your directory and every file in any subdirectory you have. The ls will only go down one level, since a ls